Base
Base
Base
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_unsubscribe cancels an active WebSocket subscription on a Base node by passing the hex ID that eth_subscribe returned, after which the node stops pushing further notifications for that stream. Base is Coinbase's OP Stack optimistic rollup that settles to Ethereum and uses ETH for gas, and with the sequencer producing a block about every two seconds an unused newHeads or logs subscription keeps firing several events per second — so closing it promptly stops needless traffic over your socket. Call it on the same WebSocket connection at https://base.therpc.io/YOUR_API_KEY against chain ID 8453 (hex 0x2105).
newHeads subscription when a user navigates away from a live Base view, so the node stops pushing ~2-second block headers your UI no longer renders.logs stream before opening a new one with updated address/topics filters — for instance when switching from watching one Base contract to another.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | subscriptionId | string | 是 | The hex subscription ID returned by eth_subscribe. |
| 类型 | 描述 |
|---|---|
| boolean | `true` if the subscription was found and cancelled. `false` if it did not exist. |
Try it live in the Base playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32602 | invalid subscription id | The subscription ID is malformed or belongs to a different connection. |
-32000 | subscription not found | The subscription was already cancelled or never existed. |
eth_unsubscribe must be called on the same WebSocket connection that created the subscription. An ID from one socket cannot be cancelled from another, and trying returns an "invalid subscription id" error.参数
The hex subscription ID returned by eth_subscribe.