Best Practices
- Connect first, subscribe second: after a successful handshake, you must send a subscribe message before any data will flow.
- Don’t skip required fields: every request needs
codeandtrace; subscribe requests additionally needdata(even if it’s just{}). - Send
api_keyat least once: either in the URL, or in the subscribe request’sdata.api_key. - Subscribe only to what you need: only subscribe to products your plan actually includes — otherwise you’ll get
40301. - Filtering to a single match: set
match_idin the subscribe request’sdata. - Reconnecting drops subscriptions: subscription state isn’t preserved across reconnects — you’ll need to re-subscribe every time.
- Failed subscribes don’t kill the connection: after an error like
40301, the connection stays open — adjust your params and retry. - Rate limiting: don’t send more than 60 messages/minute on a single connection, or you’ll get disconnected.
- Heartbeat: send
20010roughly every 30 seconds. - Connection limits: if you exceed your plan’s connection quota, the handshake may return
429. - Reconnect strategy: use exponential backoff (1s → 2s → … capped at 30s); don’t hammer reconnects immediately after a
429. - Connection stays open after unsubscribing: you can keep heartbeating, or subscribe to other products.
- Push field compatibility: business fields can be missing — don’t hard-code assumptions that every field will always be present.
FAQ
The connection succeeds but I’m not getting any data? You need to send the corresponding subscribe code (with requiredtrace and data) and receive a success ack. Also double-check whether there are actually live matches with updates right now.
Can I subscribe to multiple data products at once?
Yes. Just send 20000 / 20200 / 20100 / 20300 separately over the same connection.
How do I only receive data for a single match?
Set "match_id": "your-match-id" in the subscribe request’s data.
Does the connection drop if a subscribe request fails?
No. You’ll get an error response like 40301, and you can retry.
Does the heartbeat need a data field?
No. The heartbeat only needs code=20010 and trace.