Commands
Client Commands
This document describes the commands that clients can send to the WebSocket server.
Command Format
All commands are JSON objects with an action field:
{
"action": "command_name",
...additional fields
}Available Commands
subscribe
Subscribe to a channel
unsubscribe
Unsubscribe from a channel
ping
Keep connection alive
Subscribe
Subscribe to a channel to start receiving events.
Request
Parameters
action
string
Yes
Must be "subscribe"
channel
string
Yes
Channel name (MAIN, MAIN_REALTIME, STATS, ODDS, STATS_REALTIME, ODDS_REALTIME)
scope
string
Yes
Subscription scope: "all", "match", or "league"
id
string
Conditional
Required when scope is "match" or "league"
Success Response
When subscribing with a specific scope:
Error Response
Error Codes
CHANNEL_NOT_ALLOWED
Your plan doesn't include this channel
SUBSCRIPTION_LIMIT
Maximum subscriptions reached
INVALID_CHANNEL
Channel name is not valid
INVALID_SCOPE
Scope format is not valid
Examples
Unsubscribe
Unsubscribe from a channel to stop receiving events.
Request
Parameters
action
string
Yes
Must be "unsubscribe"
channel
string
Yes
Channel name to unsubscribe from
scope
string
Yes
Scope to unsubscribe from: "all", "match", or "league"
id
string
Conditional
Required when scope is "match" or "league"
Success Response
Error Response
Notes
Unsubscribing frees up a subscription slot
You must specify the exact channel and scope used when subscribing
Unsubscribing from a non-existent subscription returns an error but doesn't affect other subscriptions
Ping
Send a ping to keep the connection alive and verify connectivity.
Request
Response
Response Fields
type
string
Always "pong"
ts
integer
Server timestamp in milliseconds
Best Practices
Send a ping every 30 seconds to maintain the connection
Use the response timestamp to measure latency
If no pong is received within 10 seconds, consider the connection dead and reconnect
Example Implementation
Invalid Command Handling
If you send an unrecognized command, the server responds with:
Rate Limiting
Commands are rate-limited to prevent abuse
Maximum 10 commands per second per connection
Exceeding the limit results in temporary throttling
Last updated