Enable Heartbeat Streaming
API-v2stream::heartbeat::enable
Using this method, you can enable heartbeat events streaming to a specific client.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
client_id | integer | ✗ | 0 | 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 | ✗ | - | 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).
Parameter | Type | Description |
---|---|---|
streamer_id | string | An identifier for the data stream. This can be used later to disable streaming for the event with stream::disable. |
Enable Heartbeat Events
POST
stream::heartbeat::enable{
"userpass": "RPC_UserP@SSW0RD",
"method": "stream::heartbeat::enable",
"mmrpc": "2.0",
"params": {
"config": {
"stream_interval_seconds": 30
},
"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 at each heatbeat:
data: {"_type":"HEARTBEAT","message":{}}
Parameter | Type | Description |
---|---|---|
UnknownClient | string | No client has an open connection using this client_id |
ClientAlreadyListening | string | The requested events are already being sent to the client_id |