Clients send JSON text frames to subscribe, unsubscribe, and answer heartbeats.Message structure (client to server)#
{
"method": "subscribe",
"requestId": 1,
"params": ["predictOrderbook/123"]
}
| Field | Type | Required | Description |
|---|
method | string | Yes | subscribe, unsubscribe, or heartbeat. |
requestId | number | For subscribe / unsubscribe | A unique non-negative integer you choose, echoed back on the matching response so you can correlate it. |
params | string[] | For subscribe / unsubscribe | The topic to act on. One topic per request — only the first entry is used. |
data | any | For heartbeat | The exact timestamp received from the server's heartbeat. |
Subscribe#
{ "method": "subscribe", "requestId": 1, "params": ["predictMarketStatus/123"] }
The server replies with a response message (type: "R") carrying the same requestId. For snapshot-backed topics, a snapshot message (type: "M") is also pushed immediately, followed by live updates. Subscribing again to a topic you already hold is a no-op that simply re-acknowledges.Unsubscribe#
{ "method": "unsubscribe", "requestId": 2, "params": ["predictMarketStatus/123"] }
Unsubscribing always acknowledges successfully, whether or not the subscription existed.Heartbeat#
Answer each server heartbeat by echoing its timestamp. The heartbeat request has no requestId or params:{ "method": "heartbeat", "data": 1736696400000 }
See Heartbeats for the full mechanism.Errors#
A malformed or rejected request is answered with a response message whose success is false and whose error.code is one of:| Code | Meaning |
|---|
invalid_json | The message is not valid JSON. Returned with requestId: -1. |
invalid_topic | The topic is malformed, unknown, or has an invalid parameter. |
invalid_credentials | The wallet JWT is invalid, expired, or revoked. |
internal_server_error | An unexpected server error occurred. |
(Authentication failures during the initial handshake are returned as HTTP status codes, not as these JSON errors.) Modified at 2026-06-18 15:44:19