Native event formats
Envelope and source identity
{
"type": "update",
"match_id": "mf_00000000000000000001",
"feed": "B",
"cursor": "sample.8",
"received_at": "2026-01-01T12:01:08.000Z",
"data": {
"newEvents": [
{
"id": "45",
"uuid": "ed19",
"type": "1019",
"mtime": "34:28",
"info": "Goal not confirmed: Off side"
}
]
}
}
Treat match_id as the cross-channel routing ID. feed identifies A, B or C. Inside data, preserve original field names, numeric versus string values, nulls, timestamps and ordering. Optional fields may be missing. Unknown event types must remain visible via their original label. received_at is server capture time; event.ts/stime/mtime/game_time refer to source wall time or the match clock. Never generate a goal from a change in score.
A · append reported versions
snapshot replaces all fields and the entire events list. On update, assign each supplied state field (score, clock, stats, status, etc.) and append data.events to the end in original order. Missing events or [] adds zero rows. Do not deduplicate by id or action_id. An initial Goal, confirmation and later modification can share action_id. sequence_id identifies the source sequence. The stored order is oldest to newest; reverse a copy for a newest-first UI. v2 flags is_cancelled, is_modified and is_confirmed can overlap. On applicable events their display priority is cancelled, modified, confirmed. Preserve all flags and protocol, including v1.
B · prepend, correct and remove
snapshot.data is the full source state. events is newest first. On update.data apply these operations in order:
- Remove any current event matching a non-empty id or uuid in removedEvents.
- Take newEvents in the given array order. Drop events whose non-empty id is already present, including duplicates in the same batch. Put the entire surviving batch before existing events, preserving its order.
- Replace an existing event with the full object in updatedEvents having the same non-empty id. Replace it at the same position; an unknown id creates no row.
- Shallow-merge score, stats and clock by key; assign other supplied state fields. Store timer as supplied. Nested score period and stat values can contain numeric strings.
Event fields include id, uuid, type, info, side, mtime, stime, matchscore, matchstatus and optional player fields. 1018 (possible goal), 1019 (goal not confirmed) and 30 (goal) are separate native events. A new event reading “Event deleted” remains a new row. The optional display convention hides type 1831 in the timeline; the API delivers it. Render descriptions as text.
C · revisioned ordered ledger
A snapshot contains full fields, revision and events in canonical channel order. For an update, merge supplied data.state header fields, ignoring any events field nested in state. Copy data.revision. Equal revisions can contain distinct changes; deduplicate by cursor only. mode=state updates the header and preserves every event. For mode=patch:
- Index current events by id, remove event_ids, then upsert each incoming data.events by its native id. An upsert replaces the full object.
- When event_order exists, it supplies the complete new array of IDs, including when it is empty. Otherwise retain the previous order excluding removed IDs, then append order_new in the supplied order. Resolve IDs to event objects.
- Keep an original goal with is_cancelled=true as a faded, struck-through row. A subsequent native Cancel Goal with a different id remains separate. Use display_text, falling back to text or type. A newest-first display can sort a copy by descending sequence_id; preserve the underlying canonical order.
Fragment assembly and integrity verification are performed by Matchfeed before publication. Subscribers never need to assemble partial C frames. A gap with reason invalid_transfer or source_reconnect has no event payload. Apply the next snapshot as a complete replacement.
Identifier, null and ordering rules
A display. Matchfeed’s football match page uses the raw type as its label. For protocol v1 it adds no version suffix. For other protocols it omits the suffix on Reliability, DangerStateChanged, and any case-sensitive type ending in Risk or RiskEnded. All other types use the first true flag in the order cancelled, modified, confirmed. With no true flag the label stands alone. These choices only affect the label. Every version remains a row, including risk and reliability events.
B identifiers. For comparisons, convert each non-empty native ID or UUID to its text representation. Numeric 7 matches "7"; "07" is a different identifier. Missing, null and the empty string supply no comparison key. Numeric zero has the key "0". A removal compares id only with id and uuid only with uuid; either match removes the row. Insertion deduplication and replacement use only id. Keep the original JSON type in the event object. If a batch replaces one ID repeatedly, the last replacement wins.
B state. A missing score, stats or clock leaves the previous value untouched. When the key is present, shallow-merge its object members into the previous object. A top-level null contributes zero members: {"score":null} leaves an existing score object intact; if no previous object exists the result for that key is {}. An explicit null inside the object is a value: {"score":{"current":null}} sets current to null and preserves other score keys. Snapshots replace everything, including explicit nulls.
C order validation. Apply each patch atomically. The final ordered list must contain every remaining native event ID exactly once. A full event_order can position newly inserted IDs. Without it, order_new names each new ID once in append order; an update to an existing ID keeps its position. Reject duplicate or unknown ordered IDs and an upserted new ID without a position. Empty event_order is valid only when the resulting event map is empty. On a locally damaged frame, retain the last committed state and cursor, request resync or fetch a fresh snapshot. An integrity failure detected before publication produces a gap on an established stream.
Download the reducer test cases with inputs, expected states and invalid patches.