Status: OddsDirect is in development and not live yet. This page explains the subject and what the API is being built to do. Endpoints, response formats and limits will be published in the docs when the beta opens.
Why odds should be pushed, not polled
With polling you ask "anything new?" every few seconds. You either ask too often (wasted requests, rate limits) or too rarely (missed changes). With a WebSocket the server keeps one connection open and pushes each change the moment it happens.
| Polling (REST) | WebSocket (push) | |
|---|---|---|
| Freshness | Limited by your polling interval | Changes arrive as they happen |
| Request cost | Every poll counts, even with no changes | One connection, updates only |
| Complexity | Simple | Needs reconnect and resync logic |
| Best for | Pre-match, small projects | Live odds, alerts, trading tools |
A robust consumer pattern
Every streaming integration needs the same three things: reconnect with backoff, resync after a gap, and idempotent updates. Here is the pattern in Python. It is generic: it shows the structure, not the OddsDirect protocol.
# Illustrative pattern for consuming any odds stream. The OddsDirect stream URL,
# authentication and message format will be published in the docs at beta launch.
import asyncio, json, random
import websockets # pip install websockets
async def consume(url: str, handle):
delay = 1
while True:
try:
async with websockets.connect(url, ping_interval=20) as ws:
delay = 1 # connected: reset the backoff
async for raw in ws:
handle(json.loads(raw))
except (OSError, websockets.ConnectionClosed):
await asyncio.sleep(delay + random.random())
delay = min(delay * 2, 30) # exponential backoff, capped
# after a reconnect, re-fetch a full snapshot before applying new updatesChecklist for production
- Snapshot first: load the full state, then apply updates.
- Resync after reconnect: never assume you saw every update.
- Keep the key server-side: proxy the stream to browsers if you need to.
- Back off: exponential delays with jitter, capped at around 30 seconds.
- Watch freshness: alert if no message arrives for longer than expected.
The OddsDirect WebSocket
OddsDirect is building real-time bet365 odds updates over WebSocket, alongside the REST API. This is an upcoming feature.
Frequently asked questions
Does OddsDirect have a WebSocket?
Real-time updates over WebSocket are part of the planned product and marked as upcoming. The connection URL, authentication and message format will be documented at launch.
Is a WebSocket better than polling for odds?
For live odds, usually yes: you receive each change as it happens and avoid spending requests on unchanged data. Polling is fine for slow-moving pre-match data or small projects.
What happens if my WebSocket disconnects?
Reconnect with exponential backoff, then reload a full snapshot before applying new updates. Updates that arrived while you were offline are otherwise lost.
Can I use the WebSocket from a browser?
Browsers can open WebSocket connections, but an API key should never be exposed in front-end code. Connect from your server and forward what your users need.