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

eth_unsubscribe - Robinhood

Example code for the eth_unsubscribe JSON-RPC method. Complete guide to using the eth_unsubscribe JSON-RPC method in GetBlock.io Web3 documentation.

Cancels an existing subscription by ID.

Parameters

Parameter
Type
Required
Description

subscriptionId

string

Yes

Subscription ID returned by eth_subscribe

Request Example

# WebSocket-only method. Use wscat (or similar) to connect first:
wscat -c 'wss://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/'

# Then send:
{"jsonrpc": "2.0", "method": "eth_unsubscribe", "params": ["0xcd0c3e8af590364c09d0fa6a1210faf5"], "id": "getblock.io"}
import WebSocket from 'ws';

const ws = new WebSocket('wss://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/');

ws.on('open', () => {
    ws.send(JSON.stringify({
    "jsonrpc": "2.0",
    "method": "eth_unsubscribe",
    "params": [
        "0xcd0c3e8af590364c09d0fa6a1210faf5"
    ],
    "id": "getblock.io"
}));
});

ws.on('message', (data) => {
    console.log(JSON.parse(data.toString()));
});

Response Example

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

Response Parameters

Field
Type
Description

result

boolean

true if cancelled, false if no such subscription

Use Cases

  • Cleanup when a live feed is no longer needed

  • Connection lifecycle management

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32603

Internal error

Server-side error while processing the request

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?