Avalanche
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Avalanche
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
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.| # | Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|---|
| 1 | subscriptionId | string | Sí | The hex subscription ID returned by eth_subscribe. |
| Tipo | Descripción |
|---|---|
| boolean | `true` if the subscription was found and cancelled. `false` if it did not exist. |
Try it live in the Avalanche playground.
| Código | Mensaje | Causa |
|---|---|---|
-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".Parámetros
The hex subscription ID returned by eth_subscribe.