Ethereum
Prêt à utiliser cela en production ?
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
Ethereum
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
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.| # | Nom | Type | Obligatoire | Description |
|---|---|---|---|---|
| 1 | subscriptionId | string | Oui | The hex subscription ID returned by eth_subscribe. |
| Type | Description |
|---|---|
| boolean | `true` if the subscription was found and cancelled. `false` if it did not exist. |
Try it live in the Ethereum playground.
| Code | Message | Cause |
|---|---|---|
-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.Paramètres
The hex subscription ID returned by eth_subscribe.