Enable Heartbeat Streaming

stream::heartbeat::enableAPI-v2stream::heartbeat::enable

Using this method, you can enable heartbeat events streaming to a specific client.

Request Parameters

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.

Response Parameters

Parameter Type Required Description
streamer_id string An identifier for the data stream. This can be used later to disable streaming for the event with stream::disable.

📌 Examples

POST Enable Heartbeat Events stream::heartbeat::enable
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "stream::heartbeat::enable",
  "mmrpc": "2.0",
  "params": {
    "config": {
      "stream_interval_seconds": 30
    },
    "client_id": 1
  }
}
Show Enable Heartbeat Events Response
{
    "mmrpc": "2.0",
    "result": {
        "streamer_id": "HEARTBEAT"
    },
    "id": null
}

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":{}}

Error Types

Parameter Type Required 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
Show Error Responses
Error Response (Unknown Client)
{
    "mmrpc": "2.0",
    "error": "UnknownClient",
    "error_path": "heartbeat",
    "error_trace": "heartbeat:35]",
    "error_type": "EnableError",
    "error_data": "UnknownClient",
    "id": null
}
Error (Client Already Listening)
{
    "mmrpc": "2.0",
    "error": "ClientAlreadyListening",
    "error_path": "heartbeat",
    "error_trace": "heartbeat:35]",
    "error_type": "EnableError",
    "error_data": "ClientAlreadyListening",
    "id": null
}