Subscribing & Unsubscribing
Subscribing
Subscribing to checkpoints enables you to listen to current state events for accounts, transactions (such as payments) and token activity.
To subscribe to a stream with the name stream
send a text frame over the websocket connection with the following JSON payload:
{
"id": 1,
"method": "SUBSCRIBE",
"stream":
{
"name": "CHECKPOINTS",
"full": true
}
}
confirmation will be received as below:
{
"id": 1,
"result": "11223344556677889900"
}
Have a try with below command in your terminal:
{"id": 1,"method": "SUBSCRIBE","stream": {"name": "CHECKPOINTS","full": true}}
or with below:
{"id": 1,"method": "SUBSCRIBE","stream": {"name": "CHECKPOINTS","full": false}}
Unsubscribing
Similarly, to unsubscribe from a stream with the name stream
:
{
"id", 1,
"method": "UNSUBSCRIBE",
"stream": "CHECKPOINTS"
}
confirmation will be received as below:
{
"id": 1,
"result": true
}
When subscribed, try with below command in your terminal:
{"id": 1,"method": "UNSUBSCRIBE","stream": "CHECKPOINTS"}
Last updated