Skip to main content
This page documents every message you can send to the Sportrix Data WebSocket stream and every frame the server can send back. For connection setup and a quick-start example, see the WebSocket overview.

Client → Server messages

Send JSON objects to subscribe or unsubscribe from a match. The match_id is the integer id returned by the REST /matches endpoints. Subscribe:
{"action": "subscribe", "match_id": 41282}
Unsubscribe:
{"action": "unsubscribe", "match_id": 41282}

Control message fields

FieldTypeDescription
actionstring"subscribe" to start receiving updates, "unsubscribe" to stop
match_idintegerThe match id to subscribe to or unsubscribe from

Server → Client frames

Every frame the server sends is a JSON object with an op field that identifies the frame type.
opWhen sentAdditional fields
snapshotImmediately after a successful subscribedata: full live snapshot object
updateWhenever a subscribed match state changesdata: full live snapshot object
errorOn a bad control message or unauthorized subscriptionerror: human-readable reason string
The data object is a complete live snapshot, and always includes a match_id field. This lets a single connection multiplex updates from many matches — inspect data.match_id to route each frame to the right handler.

Example frames

{"op": "snapshot", "data": {"match_id": 41282, "status": "live", "score": {"home": 3, "away": 2}}}
{"op": "update", "data": {"match_id": 41282, "status": "live", "score": {"home": 3, "away": 3}}}
{"op": "error", "error": "match not live or not found"}
v1 sends a full snapshot on every update frame — there are no field-level deltas. Your handler can replace its local state entirely on each frame.
Subscribing to a match outside your enabled sport allowlist returns an error frame. The error message will indicate that the sport is not enabled for your API key.