Menu

Resume a Multi-Book Odds WebSocket After a Disconnect (since_seq, resync and snapshots)
📰

Resume a Multi-Book Odds WebSocket After a Disconnect (since_seq, resync and snapshots)

DEV Community: node·Tools for Bettors·6 days ago
#G3k3MWxn
#devtonodejs#devto#dev#state#snapshot
Long article (2003 words) — no AI summary yet.
Reading 0:00
15s threshold

A reconnect that opens a fresh socket and waits for a full snapshot is correct, but it is slower than it needs to be. If the feed gives you a monotonically increasing sequence number, you can ask for the frames you missed and keep going. If the cursor is too old, the server tells you to resync and you take a new snapshot. That is the difference between a one-second blip and a board that looks empty for the length of a snapshot.

This walk-through uses the contract documented by PricedOdds : authenticate on wss://api.pricedodds.com/v1/stream , wait for ready , subscribe, apply snapshot parts, then patch price frames. After a drop, resume with since_seq . The pattern is vendor-specific in the field names, but the state machine is the one you want on any sequenced odds stream.

It is not betting advice. It does not invent latencies or book counts.

1. What you have to remember

Keep four pieces of state, all on the client:

The last sequence number you applied. Every snapshot or price frame carries a sequence.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.