Base
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Base
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
eth_unsubscribe cancels an active WebSocket subscription on a Base node by passing the hex ID that eth_subscribe returned, after which the node stops pushing further notifications for that stream. Base is Coinbase's OP Stack optimistic rollup that settles to Ethereum and uses ETH for gas, and with the sequencer producing a block about every two seconds an unused newHeads or logs subscription keeps firing several events per second — so closing it promptly stops needless traffic over your socket. Call it on the same WebSocket connection at https://base.therpc.io/YOUR_API_KEY against chain ID 8453 (hex 0x2105).
newHeads subscription when a user navigates away from a live Base view, so the node stops pushing ~2-second block headers your UI no longer renders.logs stream before opening a new one with updated address/topics filters — for instance when switching from watching one Base contract to another.| # | Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
| 1 | subscriptionId | string | Sim | The hex subscription ID returned by eth_subscribe. |
| Tipo | Descrição |
|---|---|
| boolean | `true` if the subscription was found and cancelled. `false` if it did not exist. |
Try it live in the Base playground.
| Código | Mensagem | 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. An ID from one socket cannot be cancelled from another, and trying returns an "invalid subscription id" error.Parâmetros
The hex subscription ID returned by eth_subscribe.