Live match events
Follow a match as it happens and catch up after a lost connection.
Read the current state
GET /v1/matches/{id}/live requires matches.read and returns data with board, sequence, status, receivedAt and completeness. board can be null before live data arrives. Check receivedAt and status before displaying the score as current; stale data does not mean zero.
Live data may cover only part of a map, and its statistics are preliminary. roundsPlayed is the completed-round counter, not a round ID. Display missing values as unavailable; use match details and statistics endpoints for final results.
Subscribe with SSE or Socket.IO
SSE opens one connection per match at /v1/matches/{id}/live/stream. Without Last-Event-ID, the first message is match.snapshot. To resume, send the last applied sequence as Last-Event-ID. The example uses 42 as an illustrative cursor; omit the header for your first connection.
Socket.IO 4 uses namespace /live on the API origin and auth: { apiKey }. Send matches.subscribe with [{ matchId, afterSequence: null }] to start, or your saved afterSequence to resume. Use matches.unsubscribe with an array of match IDs to stop selected subscriptions. Acknowledge every server message; this is Socket.IO, not a raw WebSocket connection.
Both transports use your concurrent connection allowance. Keep the API key on your server and relay only the necessary data to browser clients.
curl --no-buffer "$SCORERIVER_API_URL/v1/matches/$MATCH_ID/live/stream" \
--header "Authorization: Bearer $SCORERIVER_API_KEY" \
--header "Last-Event-ID: 42"Apply events and reconnect
Apply match.snapshot as a replacement state and match.event in sequence order. Save the sequence only after applying the data. Deduplicate by matchId and sequence. match.status describes connection/data availability; it is not a score update. A redacted event advances the sequence without changing game statistics.
On match.resyncRequired, or 409 RESYNC_REQUIRED from event history, obtain a fresh snapshot and restart from its sequence. /live/events also returns nextSequence and hasMore. Always continue from nextSequence while hasMore=true, even if filters produced an empty data array.
When a sourceStatus event has data.clearBoard=true, discard the previous board. Otherwise keep the last state and update its availability indicator.