WebSocket APIRequests
Set language
Sets the language of details.outcomeName in wallet events, from the next event on,
including subscriptions that are already running. No other field or topic is translated.
Supported codes: ar, de, es, fr, hi, id, it, ja, pl, pt (or pt-br),
ru, th, tr, uk, vi, zh-CN (or zh, zh-hans) and zh-Hant (or zh-hk,
zh-tw). English and any other code give the original text, and still succeed.
x-api-key<api-key>The API key in the handshake's x-api-key header. Use this where you can.
const payload = { "method": "setLanguage", "requestId": 3, "params": [ "es" ]};const socket = new WebSocket("wss://ws.predict.fun/ws?apiKey=YOUR_API_KEY");socket.addEventListener("open", () => { socket.send(JSON.stringify(payload));});- payload
method*stringrequestId*RequestIdA number you choose, echoed on the response so you can match the two. Use a
non-negative one: the server answers a frame it cannot read with -1.
int64params*array<string>The language code. Only the first entry is read.
1 <= items{ "method": "setLanguage", "requestId": 3, "params": [ "es" ]}Reply
Sent back on the same channel.
- payload
The answer to a subscribe, unsubscribe or setLanguage request. A frame the server cannot
read (invalid JSON, an unknown method, or a missing requestId or params) is
answered with requestId -1 and the error invalid_json. A frame over 8 KiB closes
the connection.
type*stringrequestId*RequestIdA number you choose, echoed on the response so you can match the two. Use a
non-negative one: the server answers a frame it cannot read with -1.
int64success*booleanerror?Present only when success is false.
{ "type": "R", "requestId": 1, "success": true}