The server sends two kinds of JSON text frame: responses (type: "R") that answer a client request, and messages (type: "M") that push subscription data.Response (type R)#
Sent in reply to a subscribe or unsubscribe request.{ "type": "R", "requestId": 1, "success": true }
{
"type": "R",
"requestId": 1,
"success": false,
"error": { "code": "invalid_topic", "message": "unknown topic: foo" }
}
| Field | Type | Description |
|---|
type | string | Always "R". |
requestId | number | Matches the requestId of the request (or -1 if the request JSON could not be parsed). |
success | boolean | Whether the request succeeded. |
error | object | Present only when success is false. Has code and an optional message. |
See Request Format for the full list of error codes.Message (type M)#
Pushed for every subscription, including the initial snapshot and the heartbeat.{ "type": "M", "topic": "predictOrderbook/123", "data": { "...": "..." } }
| Field | Type | Description |
|---|
type | string | Always "M". |
topic | string | The topic the message belongs to, e.g. predictOrderbook/123. The heartbeat uses the reserved topic heartbeat. |
data | any | The payload for that topic. See Subscription Topics for per-topic shapes. |
Endpoint#
Connect to wss://ws.predict.fun/ws. Use ws:// only against a local development server. Modified at 2026-06-18 15:44:19