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

eth_unsubscribe - Flashblocks

Example code for the eth_unsubscribe Flashblocks method. Complete guide on how to use eth_unsubscribe Flashblocks in GetBlock Web3 documentation.

This cancels a subscription created with eth_subscribe. The subscription ID is no longer valid after this call.

Parameter
Type
Required
Description

subscriptionId

string

Yes

The subscription ID returned by eth_subscribe.

Request Example

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

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

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

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

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

Response

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

Response Parameters

Field
Type
Description

result

boolean

true if the subscription was successfully cancelled, false if the subscription ID was not found.

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

-32600

Invalid Request

Subscription called over HTTP; use WebSocket

SDK Integration

Last updated

Was this helpful?