SportsGameEvent shape. A normalized kind tells you what happened,
and the source’s own type and text tell you how it described it, so a new sport
arrives without a schema change.
It extends the sports scores stream: the same
connection, API key, scopes and ordering. You can take scores, events, or both.
Subscribing
Send aSubscribeRequest (tag 0x10) with provider: "sports", the scope as
contract_id, and sports.events in topics:
The scopes are the same as for scores:
all, family:<sportFamily>,
league:<league> and game:<gameId>, and they count toward the same 51-scope
limit. Subscribing again to a scope you hold replaces what it streams with what
you name, and sends a new snapshot. To drop only the events, send an
UnsubscribeRequest (tag 0x11) with the scope, provider: "sports" and
topics: ["sports.events"] (field 4; see
Subscribing if your
websocket_control.proto lacks it).
After the SubscribedResponse (tag 0x14), the SportsSnapshot (tag 0x24)
carries each covered game’s 50 most recent events in events, oldest first per
game. A SportsEventUpdate (tag 0x25) follows for every new, corrected,
overturned or deleted event, once per scope that covers the game. A connection that did not
ask for sports.events never receives a 0x25 frame.
Which games have play-by-play
One match is one game. A TxODDS or ESPN game links to a Polymarket game by
teams, league and date. Exactly one Polymarket game must qualify:
- the same league and sport family;
- both teams the same, by name or code, read through Polymarket’s team registry;
- dates at most a day apart, or, when either game has no date, both games started.
game_id, in its
competitor order, and that game carries the source’s id: txodds_fixture_id or
espn_event_id. Those ids are how you tell that a game has rich play-by-play.
Its scoreboard-derived events are withdrawn then, since the source reports the
same plays.
A TxODDS or ESPN game that links to no Polymarket game arrives as a game of its
own (txodds:<fixture>, espn:<league>:<event>) with source txodds or
espn. A TxODDS competition Kairos does not map to a league gets the league
txodds-<competitionId>. One that is only on the schedule, with no events yet,
is not sent. A game that was linked once does not come back as a game of its own.
Listed games without a score feed (source predictfun or schedule) have no
events.
Messages
SportsEventUpdate
SportsGameEvent
SportsParticipant
Event attributes
Every key an event’sattributes can hold. An attribute is present only when
it has a value. New keys may be added; ignore any you do not know.
SportsEventMeasure
Kinds
kind is one of:
New kinds may be added. Treat a kind you do not know as
other, and show
source_type and description as the source wrote them.
Subtypes
subtype refines a kind. It is empty when the source gives nothing finer, and
the lists may grow; treat a subtype you do not know as empty.
American football (TxODDS)
Each play carries TxODDS’s own time (occurred_at_ms), message sequence, raw
action (source_type) and the quarter clock. A flag and its enforcement are one
penalty, whose detail attribute reads e.g. offensive, 5 yds, accept and
whose side is the penalized team. A scoring play arrives on the play itself;
TxODDS confirms it a little later. A play it never confirms, or whose points it
takes back, is overturned.
Overturned plays and reviews
The feed is a record of the game. A play that happened stays on it when it is reversed: a goal disallowed by VAR, a touchdown taken off on review, a basket ESPN removes after a challenge, or a score the scoreboard corrects down. Kairos sends the play again at a higherrevision with the attribute overturned
set to true and scoring set to false. Its kind, subtype and points
stay as they were called, so you can show “Goal (disallowed)”. The game’s own
score already excludes it.
A review and its outcome are events of their own, of kind review. Each
carries ref_event_id, the event_id of the play it concerns:
Sorted by
sort_key, a review follows the play it concerns and its outcome
follows the review. An event Kairos adds sorts after the newest event of the
game when the play was reversed. TxODDS reports how a VAR check ended only for a
goal; other checks get no outcome. ref_event_id may name an event older than
the snapshot. A play overturned and then listed again by its source stands
again: it arrives without overturned, at a higher revision, and an outcome
Kairos added for it (source_type overturned or score_correction) is deleted.
Of a source’s own changes, only a feed error is deleted: true: an event that
duplicates a play its source still lists, one Kairos could not name (other)
that carried no text, or an outcome Kairos added for a play that stands again.
Events also leave a game deleted when it links to a play-by-play source, or when
a source’s link moves to another game.
Ordering and corrections
Event frames share(lease_epoch, seq) with game updates, so a game’s update
always arrives before its first event. For each event_id, keep the
revision you hold and ignore a frame whose revision is not greater. A
correction, such as a player added to a goal or an edited play, arrives as the
same event_id with a larger revision and the whole new state; so does an
overturned play. A deleted event arrives with deleted: true; drop it. The same check drops the copies
that overlapping scopes deliver, and the repeats sent after a gateway restart.
When a game’s SportsGameUpdate is REMOVED, drop its events too. After a
disconnect, reconnect, subscribe again, and rebuild from the snapshot. The
snapshot holds each game’s 50 most recent events; it is not the game’s full
history.
Errors
Subscribe errors arrive asErrorResponse (tag 0x17) with action
subscribe_error:sports:<scope>, as on the scores stream. Play-by-play adds:
If events are switched off while you hold them, each scope with
sports.events
gets an ErrorResponse with action sports_events_disabled:<scope> and
message Live sports play-by-play was switched off; scores continue. The
scope loses sports.events, and no UnsubscribedResponse is sent. Its scores
keep flowing; a scope that held only sports.events is gone. To get events
back, subscribe to the scope again with the topics you want once play-by-play
is back on. Until then that subscribe is refused with
Live sports play-by-play is switched off.
When scores are switched off or stop updating, the whole scope is dropped,
events included; see
Errors while subscribed.
Example
(lease_epoch, seq); see
Ordering and recovery for
that check. Sort a game’s timeline by sort_key, then event_id, to show it in
order.
