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

getblock_unsubscribe - Solana Market Data

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

getblock_unsubscribe cancels a subscription created with getblock_subscribe. Delivery for that subscription stops immediately and the subscription ID is no longer valid. 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/solana-mainnet/stream?apiKey=<API-KEY>'
# WebSocket-only. On the connection that owns the subscription, send:
{"jsonrpc":"2.0","id":"getblock.io","method":"getblock_unsubscribe","params":[{"subscription":"0x4503d281ca474f3322ed277fde75db15"}]}
ws.send(JSON.stringify({
  jsonrpc: '2.0',
  id: 'getblock.io',
  method: 'getblock_unsubscribe',
  params: [{ subscription: subscriptionId }]
}));
await ws.send(json.dumps({
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "method": "getblock_unsubscribe",
    "params": [{"subscription": subscription_id}]
}))

Response Example

{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "result": true
}

Response Parameters

Field
Type
Description

result

boolean

true when the subscription was cancelled. No further notifications are delivered for it.

Use Cases

  • Switching a chart or dashboard from one market pair or window to another

  • Releasing streams a user has navigated away from without dropping the socket

  • Managing several subscriptions on one connection independently

  • Tearing down cleanly on component unmount

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 — for example a bare ID string.

-32602

subscription is required

The object was passed without a subscription field. Note that id is not an accepted alias.

Last updated

Was this helpful?