Optimism
Prêt à utiliser cela en production ?
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
Optimism
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
eth_unsubscribe cancels an active WebSocket subscription on OP Mainnet — the OP Stack rollup that settles to Ethereum L1 and pays gas in ETH — by passing the hex ID that eth_subscribe returned. Once cancelled, the node stops pushing further eth_subscription notifications for that stream, which keeps your connection lean when you no longer need newHeads, logs, or pending-transaction events. Issue the call over the same WebSocket at https://optimism.therpc.io/YOUR_API_KEY (chain ID 10, 0xa). It returns true if the subscription was found and removed, or false if it did not exist.
newHeads subscription when a user leaves a live OP Mainnet block view, so the node stops streaming updates the UI no longer renders.logs subscriptions by unsubscribing the old ID before opening a new one with updated address or topic filters, avoiding overlapping duplicate streams.| # | 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 Optimism 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. |
false.eth_unsubscribe is optional on teardown — but it is still good practice when you keep a long-lived connection open and only want to drop one stream.Paramètres
The hex subscription ID returned by eth_subscribe.