WebSocket APITopics
Category changed
Receive
Server
Subscribe with predictCategoryChanged/{categoryId}. Refetch the category, 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": "predictCategoryChanged/45", "data": { "kind": "categoryChanged", "patchKind": null, "tsMs": 1736696400000, "categoryId": 45, "slug": "politics" }}Market changed
Subscribe with predictMarketChanged/{marketId}. Refetch the market, or apply patch when the message carries one. Nothing is sent on subscribe.
Wallet events
Subscribe with predictWalletEvents/{jwt}, where jwt is a wallet JWT from the REST API's POST /auth. A revoked, invalid or expired JWT is refused with invalid_credentials. Nothing is sent on subscribe.