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

unsubscribe - XRPL

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

This method tells the server to stop sending messages for a particular subscription.

Parameters

Parameter
Type
Required
Description

streams

array

No

Streams to unsubscribe

accounts

array

No

Accounts to stop watching

accounts_proposed

array

No

Proposed tx accounts

books

array

No

Order books to stop watching

Request Example

cURL
curl --location --request POST 'https://go.getblock.io/<ACCESS_TOKEN>/' \

--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "unsubscribe",
    "params": [{
        "streams": ["ledger"]
    }],
    "id": "getblock.io"
}'
unsubscribe.js
const axios = require('axios');

const url = 'https://go.getblock.io/<ACCESS_TOKEN>/';
const headers = {
    'Content-Type': 'application/json'
};

const payload = {
    jsonrpc: '2.0',
    method: 'unsubscribe',
    params: [{
        streams: ['ledger']
    }],
    id: 'getblock.io'
};

axios.post(url, payload, { headers })
    .then(response => console.log(response.data))
    .catch(error => console.error(error));

Response Example

Response Parameters

Parameter
Type
Description

status

string

Unsubscribe status

Use Cases

  • Stop receiving updates

  • Clean up connections

  • Resource management

Error Handling

Error Code
Description

invalidParams

Invalid parameters

SDK Integration

Last updated

Was this helpful?