Log in
Send alogin frame as the first message, within 10 seconds of the connection:
The server answers
login_ok with what it applied:
connectionId is a UUID that identifies this connection. Quote it when you report a problem.
A refused login closes the connection with 4001. One connection logs in once: a second login frame gets an error frame.
Change what you follow
Add or remove fixtures, tournaments and sports without reconnecting:subscribed or unsubscribed with the whole selection now in force. The channels are fixed at login.
Channels
bookmakers, currencies, fixtures, scores, clocks and odds are the feed channels: they carry changes only, and you load the current state from /v1/{lang}. balance, betslip and orders are the execution channels: they carry the state of your account.
Envelope
Every channel message has the same envelope:channelandtypetell you how to readpayload.tsis a Unix time in milliseconds. On feed channels, it is when Apexium received the message; on execution channels, when it sent it.seqis present on execution channels only. It counts the execution messages of this connection and starts again at 1 on every connection. It is not a resume cursor: resumeorderswitheventId.
type and no channel: login_ok, subscribed, unsubscribed, betslip_subscribed, betslip_unsubscribed, snapshot_required, reconnect and error. They are always JSON text frames, whatever your receiveType.
An error frame reports a frame the server could not apply, and the connection stays open:
error frame carries the connectionId of the connection, including one sent before login_ok or right before a close.
Limits
A connection that reads too slowly is closed with
4002. See Close codes.
Heartbeat
The server sends a WebSocket ping every 30 seconds. Client libraries answer with a pong on their own. A connection that leaves two pings in a row unanswered is dropped. You do not need to send pings yourself.Reconnect
Reconnect after any close, with an exponential backoff and a random jitter: for example 1 second, then doubling up to 30 seconds, each delay multiplied by a random factor between 0.5 and 1.5. The jitter keeps your connections from all coming back in the same instant. After a reconnect:- Feed channels. Load the state of your fixtures again from
/v1/{lang}, then apply the messages. orders. Log in withsinceEventIdto receive what you missed. See Orders.balance. The current balance arrives right afterlogin_ok.betslip. Send yoursubscribeBetslipframes again.
{ "type": "reconnect", "reason": "server_restart" } and closes with 1012: reconnect at once.
Languages
Thelang of the login applies to the fixtures channel: the names of the sport, tournament, status, participants and venue follow it when a translation exists. It takes the same values as the market data paths. The other channels carry identifiers and numbers only, and identifiers never depend on the language.
Bookmakers
Theodds and bookmakers channels carry only the bookmakers that GET /v1/me lists: those of your account, except any closed to the API. A message left with none of your bookmakers is not sent. When that list changes, open connections follow within a few seconds.