VALUEODDSAPI / BUYER GUIDES
How do you recover an odds API stream after a disconnect?
Persist the last applied epoch and sequence, attempt resume within the documented window, and rebuild from a snapshot when replay is unavailable.
Published by ValueOddsAPI · 28 November 2026
In 30 seconds
- Start with a snapshot. A subscription sends matching price rows before subsequent changes.
- Persist progress after applying it. Keep the last processed
epochandseqtogether. - Resume only within the window. The v2 contract describes five minutes and up to 1 MB of replay.
- Rebuild when required.
snapshot_requiredmeans the local live view needs a new snapshot.
What state does a live odds client need?
The v2 stream reference describes a server-side WebSocket at wss://api.valueoddsapi.com/v2/stream. Authenticate with the X-API-Key header and subscribe to the intended events, markets and bookmakers. A subscription sends a snapshot, then price, status and event messages. The OpenAPI contract also defines heartbeat and control messages.
Persist the intended subscription filters, a local current-price store keyed by price_id, and the last applied epoch/seq pair. Do not mark a sequence processed before its state update is durable; otherwise a crash can skip the update on resume. That persistence order is a client recommendation, not a claim about server storage.
Which frames change the current price view?
| Frame | Contract detail | Client action |
|---|---|---|
snapshot | Price rows; the contract permits parts and a final marker. | Collect a complete snapshot before treating the view as ready. |
price / status | Delta carries price_id and changed fields. | Merge fields by ID; remove suspended or removed quotes from actionable offers. |
event | Event ID and status are supplied. | Update event state separately from bookmaker price state. |
heartbeat | Connection liveness signal. | Do not treat it as proof that each bookmaker quote was just checked. |
snapshot_required | Resume cannot replay the gap. | Clear the live-ready flag and build a fresh snapshot. |
Frame shapes are documented in the v2 contract and stream reference. Client actions are integration recommendations.
How does resume work after a disconnect?
After reconnecting, send a resume message with the last epoch and seq, where last_seq is the last data message your client actually applied. The StreamResume schema says the server replays data messages after that sequence for five minutes and up to 1 MB. Those are protocol limits, not a guaranteed recovery time for your own application.
If the gap is too old or too large, expect snapshot_required and subscribe for a new snapshot. Mark your displayed quotes as not live while recovery is incomplete. A seq gap in the frames your client applies is also a reason to reconcile rather than silently continue. Use status semantics when rebuilding the actionable view.
What should a reconnect test actually measure?
Run a pilot on entitled sports and bookmakers. Log subscription filters, disconnect time, last applied epoch/seq, whether resume succeeded or required a snapshot, time until the view became current again, and any duplicate price_id rows. Repeat across short and deliberately long interruptions. Compare the rebuilt store with a complete paginated REST snapshot.
Do not quote a universal delay from the five-minute replay window. Latency and recovery depend on your network, consumer code, subscription size and data flow. Check GET /v2/me for the actual connection entitlement and current plan scope before sizing workers. This article publishes no measured uptime or recovery result.
Frequently asked questions
Can a heartbeat replace freshness checks?
No. It shows the stream connection is alive; checked_at on each price indicates when that quote was last observed.
What if resume returns snapshot_required?
Treat the local book as not live, subscribe again and rebuild it from a complete snapshot.
Should the client store the sequence before applying a delta?
No. Persist the last sequence only after the corresponding state update is safely applied, so a crash does not skip it.
Can a WebSocket connection remove all REST polling?
A stream sends a snapshot and changes, but a complete REST snapshot remains useful for reconciliation after gaps or client errors.
ValueOddsAPI provides odds data, not betting advice. Betting involves risk of loss and is for adults (18+) only. If gambling stops being fun, contact your local support service, such as StopSpillet in Denmark.
Pilot the failure path
Read the stream protocol, test reconnection with your own key and target subscription, and measure recovery against a complete REST state. Keep the product decision tied to your measured workload and entitlement.