unsubscribe - Stable

Cancels a specific subscription on the WebSocket connection, identified by its event query.

Method

unsubscribe

Parameters

ParameterTypeDescription
querystringThe event query to unsubscribe from

Example

bashexport STABLE_TM=https://shared.ap-southeast-1.getblock.io/<ACCESS-TOKEN>/

# JSON-RPC over WebSocket (append /websocket to the endpoint)
wscat -c "wss://shared.ap-southeast-1.getblock.io/<ACCESS-TOKEN>/websocket" \
  -x '{"jsonrpc": "2.0", "id": "getblock.io", "method": "unsubscribe", "params": {"query": "tm.event='NewBlock'"}}'

Response

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

Response Fields

FieldTypeDescription
resultobjectEmpty on success

Use Cases

  • Cleanup: Stop a specific event stream

Error Handling

ErrorMessageDescription
-32600 / Invalid requestInvalid requestThe JSON-RPC envelope was malformed
-32602 / Invalid paramsInvalid paramsA parameter was missing or of the wrong type
403 / RBAC: access deniedAccess deniedThe GetBlock access token is missing or incorrect