Ethereum
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Ethereum
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
eth_unsubscribe is the off-switch for the live event streams you open with eth_subscribe over a WebSocket connection to Ethereum mainnet (chain ID 1). When you subscribe to something like newHeads, logs, or newPendingTransactions, the node starts pushing a notification every time a new block is sealed (one per 12-second slot) or a matching event lands. To stop that flow, send eth_unsubscribe with the subscription ID you were handed at subscribe time. Note the transport: these methods only exist over WebSocket, so you call them against wss://ethereum.therpc.io/YOUR_API_KEY rather than the HTTPS endpoint used for one-shot ETH queries. The return is true when the subscription was found and cancelled, false when nothing matched the ID.
newHeads stream the moment a user leaves a live block explorer view, so you stop paying for and processing one push every 12 seconds.logs subscription first, then open a fresh one with the new params.| # | 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 Ethereum 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 on that same WebSocket connection; the ID is meaningless on any other one, which is why a stale ID returns the invalid subscription id error.Parámetros
The hex subscription ID returned by eth_subscribe.