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

Command
Description

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

Field
Type
Required
Description

action

string

Yes

Must be "subscribe"

channel

string

Yes

Channel name (MAIN, STATS, ODDS, STATS_REALTIME, ODDS_REALTIME)

scope

string

Yes

Subscription scope

Scope Options

Scope
Format
Example
Description

All

all

"all"

All events on the channel

Match

match:{id}

"match:12345"

Events for a specific match

League

league:{id}

"league:67890"

Events for all matches in a league

Success Response

Error Response

Error Codes

Code
Description

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

Field
Type
Required
Description

action

string

Yes

Must be "unsubscribe"

channel

string

Yes

Channel name to unsubscribe from

scope

string

Yes

Scope to unsubscribe from

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

Field
Type
Description

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