WebSocket APITopics
Market changed
Receive
Server
Subscribe with predictMarketChanged/{marketId}. Refetch the market, or apply patch
when the message carries one. Nothing is sent on subscribe.
header
x-api-key<api-key>The API key in the handshake's x-api-key header. Use this where you can.
const socket = new WebSocket("wss://ws.predict.fun/ws?apiKey=YOUR_API_KEY");socket.addEventListener("message", (event) => { console.log(event.data);});application/json
- payload
type*stringtopic*stringThe topic string the subscription was made with.
data*{ "type": "M", "topic": "predictMarketChanged/123", "data": { "kind": "marketChanged", "patchKind": null, "tsMs": 1736696400000, "marketId": 123 }}