---
title: "eth_unsubscribe"
description: "取消此前创建的订阅（Base）"
url: "https://blockreq.com/docs/zh-cn/build/api-reference/base/eth_unsubscribe/"
---

# eth_unsubscribe

**网络：** Base · 主网 · Chain ID `8453`（`0x2105`）

**计为 1 个 Request。** 计费规则见 [Request Counting](https://blockreq.com/docs/zh-cn/pricing/request-counting/index.md)。

> **协议**：仅支持 WebSocket（WSS）

## 描述

取消此前创建的订阅。

## 参数

| 参数             | 类型  | 必填 | 说明    |
| ---------------- | ----- | ---- | ------- |
| `subscriptionId` | `hex` | 是   | 订阅 ID |

## 请求

```json
{
  "jsonrpc": "2.0",
  "method": "eth_unsubscribe",
  "params": ["0x1"],
  "id": 1
}
```

## 代码示例

**TypeScript**

```typescript
const ws = new WebSocket("wss://base-rpc.blockreq.com/v1/rpc/public");

ws.onopen = () => {
  ws.send(JSON.stringify({
  "jsonrpc": "2.0",
  "method": "eth_unsubscribe",
  "params": [
    "0x1"
  ],
  "id": 1
}));
};
ws.onmessage = (event) => {
  console.log(JSON.parse(event.data));
};
```

**Python**

```python
import asyncio
import json

import websockets

async def main():
    async with websockets.connect("wss://base-rpc.blockreq.com/v1/rpc/public") as ws:
        await ws.send('{"jsonrpc":"2.0","method":"eth_unsubscribe","params":["0x1"],"id":1}')
        async for message in ws:
            print(json.loads(message))

asyncio.run(main())
```
