Live stream¶
GET /live/stream[?league=<league>][&division=<division>]
The game state of /live pushed as it changes, on fixtures.halfpoint.tech: scores,
period and clock while a game is played, and the result when it ends. Needs the
Realtime or Risk plan; otherwise 403.
| parameter | ||
|---|---|---|
league |
optional | one league, default all |
division |
optional, cfb only |
fbs or fcs |
It is plain Server-Sent Events
over HTTP: one JSON object per event, with the key sent as usual. Errors (400, 401, 402,
403, 429) are normal status codes before the stream starts.
A key may have 8 streams open at once, counted with the odds stream together (2 while its only plans
are trials); another one answers 429, too many open streams for this key (8); close one or
contact us. Closing a stream frees its slot. See Plans.
curl -N -H "X-Api-Key: $KEY" "https://fixtures.halfpoint.tech/live/stream?league=nhl"
event: state
id: 48213
data: {"id":"nhl-261029-cbj-car","league":"nhl","status":"In Progress","scores":{"total":{"away":0,"home":2},"periods":{"1":{"away":0,"home":2}}},"period":1,"clock":"4:04"}
event: remove
id: 48214
data: {"id":"nhl-261029-cbj-car"}
: ping
First comes the current state, one state event per game; then every change.
| event | data |
|---|---|
state |
a game as in /live: it replaces what you hold |
remove |
id: the game left /live |
Lines starting with : are comments that keep the connection open, about every 30 s. SSE clients
ignore them.
Results¶
A game's result arrives as a state event with status Final. The game stays on the stream for
2 hours, as in /live, then gets its remove. If a final score is corrected within that time, a
new state carries it.
A game that stops being played sends a last state with its status, such as Suspended or
Postponed, and then its remove.
Timing¶
The stream sends a change as soon as we have it, so you skip your polling interval. It follows the
games as /live does: within seconds of the sources reporting them. Most events during
a game are clock updates.
Reconnecting¶
Reconnect whenever the connection drops, and start over from what the stream sends first: there
is no replay of missed events, so anything you hold that isn't in the new state is gone.
Last-Event-ID isn't supported. A client more than 1,024 events behind is disconnected the same
way.
The stream's subscription is its league and division: to change them, reconnect.