Skip to main content
The SportriX WebSocket stream delivers live scores and statistics in real time — no polling required. As soon as a match state changes, you receive the full updated snapshot. Accessing the WebSocket stream requires the live_scores_statistics scope. Endpoint: wss://scores.sportrix.ai/v1/stream

Python example

The example below uses the websocket-client library to connect, subscribe to a match, and print a live score line on every update.
Always branch on d["sport"] — the snapshot schema is sport-specific. See the live snapshot reference for the full soccer and cricket shapes.

Multiplexing multiple matches

A single WebSocket connection can track any number of matches simultaneously. Send a subscribe message for each match you want to follow — there’s no need to open a separate connection per match. Because every data object carries match_id, you can always tell which match an incoming frame belongs to.

Keeping the connection alive

The stream server sends a WebSocket ping every 30 seconds so idle connections survive client and proxy read timeouts on quiet matches. Make sure your client’s read/idle timeout is above 30 seconds (60 seconds is a good default) — you don’t need to send anything yourself, since most libraries auto-pong. See Keepalive (ping/pong) for library-specific examples.
If you only need live scores and the match clock (not full statistics), REST polling on GET /matches/{id}/live may be simpler and only requires the live_scores scope. Use the WebSocket when you need sub-second latency or want to stream stats to a live display.