Avalanche
Avalanche
Avalanche
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_unsubscribe cancels an active WebSocket subscription on an Avalanche C-Chain node, identified by the ID that eth_subscribe returned. Once cancelled, the node stops pushing eth_subscription notifications for that stream, so it is how you tear down a newHeads, logs, or pending-transaction feed you no longer need. On the C-Chain — the EVM chain where AVAX pays for gas, secured by Snowman/Avalanche consensus — releasing idle subscriptions keeps a long-lived connection tidy. Issue the call over the same wss:// session opened against https://avalanche.therpc.io/YOUR_API_KEY (chain ID 43114, 0xa86a).
newHeads subscription when a user navigates away from a live C-Chain view, so the node stops pushing block headers your UI no longer renders.logs stream before opening a new one with updated address or topic filters, avoiding overlapping notifications.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 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 Avalanche 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. A subscription ID from one socket is unknown to another, so a cross-connection call returns "invalid subscription id".参数
The hex subscription ID returned by eth_subscribe.