Enable Balance Streaming
Using this method, you can enable balance events streaming for a specific coin, to a specific client. For ETH-like coins and tokens, you can also specify the streaming interval in seconds (to avoid excessive polling leading to upstream API rate limts)
Parameter* = required | Type | Description |
---|---|---|
coin* | string | Ticker of the coin to activate streaming for. The coin must be activated first. |
client_id | integer default: `0` | Optional. In the case of a single client, this defaults to 0 . This ID can be used to access data via http://localhost:7783/event-stream?id=1 |
config | object | Optional. EVM only. A standard StreamingConfig object. |
The client defines its own id when opening a connection to the stream, and each client_id can only be viewed by a single client (i.e. the ?id=
url param won't work in more than one browser tab).
The selected coin must be enabled prior to enabling streaming.
Parameter* = required | Type | Description |
---|---|---|
streamer_id | string | Optional. An identifier for the data stream. This can be used later to disable streaming for the event with stream::disable. |
Balance Enable
{
"userpass": "RPC_UserP@SSW0RD",
"method": "stream::balance::enable",
"mmrpc": "2.0",
"params": {
"coin": "MATIC",
"config": {
"stream_interval_seconds": 15
},
"client_id": 1
}
}
Here is an example of the stream data you should be able to see in http://localhost:7783/event-stream?id=1 once a balance change is detected:
data: {"_type":"BALANCE:MATIC","message":[{"ticker":"MATIC","address":"0xc11b6070c84a1e6fc62b2a2acf70831545d5edd4","balance":{"spendable":"2.00000001","unspendable":"0"}}]}
Parameter* = required | Type | Description |
---|---|---|
ClientAlreadyListening | string | Optional. The requested events are already being sent to the client_id |
CoinNotFound | string | Optional. The specified coin was not found or is not activated yet |
EnableError | string | Optional. The config object is not used in non-EVM coins or other configuration errors |
UnknownClient | string | Optional. No client has an open connection using this client_id |