Skip to main content
This walks through the full consumer path, using a soccer session with id T1 as the example.

1. Backfill the tape

When you connect, the WebSocket sends the current state but no history. So on first load, fetch the full event log from /history to fill in what already happened, then add live frames on top.
events is the full log, oldest to newest, where each entry is the same WireEvent a live frame carries. The state is not returned here — and you don’t compute it: the WebSocket you open next delivers the current match snapshot on connect and a fresh one on every frame. /history fills in the tape of what already happened. The team display names come from the top-level matchup {a, b}, so you can render the header straight from it. The schema identity is the pair (sport, contractVersion) — the version the log was recorded under counts per sport — so compare both to know how to interpret the events; older games stay readable even after the schema changes. See the History backfill for the full field reference.

2. Open the WebSocket

The first message is the hello ({"type": "hello", "contractVersion": ..., "sport": ..., "league": ...}); then comes the snapshot you get on connecting: event is null and state is the current match state. Every frame after that carries both the event that happened and the full state that resulted. See the WebSocket feed — including the close codes that decide when reconnecting is correct.

3. Stay in sync

The pattern is always the same:
  • Replace your snapshot with frame.state on every frame — never reconstruct state from events yourself.
  • Append frame.event to your tape when it is non-null.
  • On reconnect, re-backfill from /history (dedup by seq against your existing tape) then re-subscribe.
frame.outSeq always increases. A gap means you missed a frame, but there is nothing to resend — the next frame’s state already brings you back in sync.

4. Reading the snapshot

Steps 1–3 are identical for every sport — only the snapshot fields differ. This example session is soccer, so the fields below are soccer’s:
See Match State for every field and Soccer Events for the full event vocabulary. Consuming a different sport? The integration is the same — start from that sport’s state instead: Basketball (clock, period, openAttempt) or Baseball (inning, outs, bases).