WebSocket APIRequests

Set language

Send
/ws
Server

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.

Authorization

headerx-api-key<api-key>

The API key in the handshake's x-api-key header. Use this where you can.

Code Sample
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));});

Messages

application/json
  1. payload
method*string
requestId*RequestId

A 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.

Formatint64
params*array<string>

The language code. Only the first entry is read.

Items1 <= items
spanish
{  "method": "setLanguage",  "requestId": 3,  "params": [    "es"  ]}

Reply

Receive

Sent back on the same channel.

application/json
  1. 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*string
requestId*RequestId

A 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.

Formatint64
success*boolean
error?

Present only when success is false.

{  "type": "R",  "requestId": 1,  "success": true}