Skip to content

Get a ticket for a live socket

POST
/api/notifications/ws-ticket
curl --request POST \
--url https://foxleague.ai/api/notifications/ws-ticket \
--header 'Authorization: Bearer <token>'

Answers a ticket that opens a live socket. It opens your notification socket (/ws/notifications?ticket=<ticket>) as well as the live socket of a ranked or casual match you play in (/ws/match/{id}?ticket=<ticket>). A browser cannot send the session header on a WebSocket, so the ticket stands in for it. A ticket works once and only within 30 seconds: get a new one for every connection.

Who: a signed-in player.

Refusals:

  • Not registered: the wallet has no account.

Success or a refusal: read success (the refusals are in the description).

Media type application/json
object
code

A machine-readable reason next to error, set only where the caller must act differently. tx_pending: the payment was not refused but could not be verified yet; keep the transaction hash and confirm again with the same hash, never pay twice.

string | null
data

The answer. Present when success is true.

object
ticket
required

A single-use ticket, valid for 30 seconds.

string
error

Why the request was refused, in plain words. Present when success is false.

string | null
success
required

true when the request did what it asked. false is a refusal: read error.

boolean
Example
{
"data": {
"ticket": "64a149f5e3838b9ed5a9422a8bc08311"
},
"success": true
}

No valid session. The body is plain text: Missing Authorization header, Invalid Authorization format, Invalid session token or Session expired or invalid. Sign in again.

Media type text/plain
string
Example
Session expired or invalid