betting_combat.providers.cito.stream
stream.py — Cito’s live push over SSE (/ufc/live/stream): every live reading of one bout
(bout_id) or one card (event_slug) as it changes, held open while a card runs.
LiveFrame one frame: its event name, when we received it, the reading (``LiveState``)CitoStream the SSE stream: ``frames()`` yields frames, reconnecting with backoffCitoSocket the WebSocket (the +$15 add-on; 403 without it): rooms ``bout:{live id}`` and ``event:{slug}``, ``ufc.live.update`` readings and ``ufc.odds.updated`` frames; frames do not count against the month. Unverified until the add-on is boughtBilling: one call at connect, then one for every 15 s open (the same as polling every 15 s), so
open it while a card is live and close it after. The frames: ready (the rules), then
ufc.live.snapshot (the bout’s current reading, with bout_id set), ufc.live.update
(each change), ping every 15 s, error (RATE_LIMIT_EXCEEDED closes it: asked again
after RATE_LIMITED_S). Nothing for READ_TIMEOUT_S (four pings missed) is a dead
connection: rebuilt. Per-round
lines never ride the stream: Cito.snapshots has them.
Classes
CitoSocket
Cito’s room WebSocket, through a Cito client’s key: re-subscribed after every
reconnect (catch a missed reading up with Cito.live_state).
close
close() -> Noneframes
frames() -> AsyncIterator[LiveFrame]CitoStream
The SSE stream of one bout or one card, through a Cito client’s key and budget.
close
close() -> Noneframes
frames() -> AsyncIterator[LiveFrame]Every frame, reconnecting (1 s, 2 s, … up to max_backoff_s; RATE_LIMITED_S
after a rate-limit error) until close().
LiveFrame
One frame: the event name, our receive time, the reading (None on ready/ping/error),
and the raw data (the rules on ready, the code on error).