Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

getblock_unsubscribe - EVM Data Stream

Cancel an active EVM Data Stream subscription. Complete guide on how to use getblock_unsubscribe in GetBlock EVM Data Stream documentation.

getblock_unsubscribe cancels a subscription created with getblock_subscribe. Delivery for that subscription stops and it no longer counts toward your 15-subscription limit. Other subscriptions on the same socket are unaffected.

Parameters

params is an array containing exactly one object:

Parameter
Type
Required
Description

subscription

string

Yes

The subscription ID returned by getblock_subscribe.

Request Example

wscat -c 'wss://stream.eu-central-1.getblock.io/v1/eth-mainnet/stream' -H 'Authorization: Bearer <API-KEY>'
# WebSocket-only. On the connection that owns the subscription, send:
{"jsonrpc":"2.0","id":2,"method":"getblock_unsubscribe","params":[{"subscription":"0x573e3382e8ea7d534f267b232aae22dd"}]}
ws.send(JSON.stringify({
  jsonrpc: '2.0',
  id: 2,
  method: 'getblock_unsubscribe',
  params: [{ subscription: subscriptionId }]
}));
await ws.send(json.dumps({
    "jsonrpc": "2.0",
    "id": 2,
    "method": "getblock_unsubscribe",
    "params": [{"subscription": subscription_id}]
}))

Response Example

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": true
}

Response Parameters

Field
Type
Description

result

boolean

true when the subscription was cancelled. false when no active subscription with that ID exists on this connection, for example because it was already cancelled.

An event that was already in flight can still arrive shortly after you unsubscribe. Drop notifications whose params.subscription you no longer track.

Use Cases

  • Switching a wallet view from one address to another without dropping the socket

  • Freeing a slot when you approach the 15-subscription limit

  • Replacing a subscription with one that has different filters (subscriptions cannot be modified in place)

  • Tearing down cleanly when a component unmounts

Error Handling

Code
Message
Cause

-32602

getblock_unsubscribe params must contain one object

params was empty, held more than one entry, or the entry was not an object, such as a bare ID string.

-32602

subscription is required

The object has no subscription field. id is not an accepted alias.

Last updated

Was this helpful?