Client → Server messages
Send JSON objects to subscribe or unsubscribe from a match. Thematch_id is the integer id returned by the REST /matches endpoints.
Subscribe:
Control message fields
Server → Client frames
Every frame the server sends is a JSON object with anop field that identifies the frame type.
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
Ended frames
The server sends anended frame when a subscribed match leaves the live feed. The frame has no data object. Read the match id from the top-level match_id field.
An ended frame does not unsubscribe you. Your subscription stays active until you send unsubscribe or close the connection. If the match reappears on the feed afterwards, for example after a transient provider gap, the server resumes the stream with a fresh snapshot frame followed by update frames. You don’t need to resubscribe.
Final snapshot for basketball and American football
For basketball and American football, SportriX sends a finalupdate frame with "status": "ended" immediately before the ended frame. This update carries the full final snapshot: score, periods, stats, and box score. SportriX also stores it, so GET /matches/{id}/live returns the same final snapshot after the match ends.
update in these cases:
- Soccer: the last
updatealready carries"status": "ft". - Cricket: multi-day Tests leave the live feed between days, so
endeddoes not mean the match is over. - Matches that never started: no final snapshot is published.
ended as “no longer live” rather than as a final state. For basketball and American football, use the "status": "ended" snapshot as the final result.
If you no longer want frames for the match, send an unsubscribe message:
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.
