snapshotChecksum versus the full engine checksum and optional native Worker ownership.
- SDK (vanilla JS/TS)
- Hooks (React)
- UI Components
Full control over the WebSocket connection and local orderbook state.The SDK applies snapshots and deltas for you, tracks
1. Connect and subscribe
seq, validates checksum (XOR of
per-level CRC32), drops stale deltas where seq <= current.seq, and requests a fresh snapshot
when integrity checks fail. It also runs a 5-minute book watchdog; see
Integrity.2. Read the orderbook
Orderbooktimestamp is Unix milliseconds on the wire, and the SDK reports it as seconds.The OrderbookState passed to callbacks uses object-shaped levels:3. Per-venue orderbooks
Per-venue depth is available on the same object:4. REST fallback
For one-time fetches without a live socket:Integrity
The SDK keeps each book correct without any code from you:- Seq and checksum: it applies deltas only in order, verifies every
checksum, and requests a fresh snapshot when either check fails. - Server-sent snapshots: if AGG rebuilds a book, its
seqrestarts and the gateway sends a new snapshot with the first update from it. The SDK replaces the book with it. - Connection liveness: it reconnects with backoff after 45 seconds with no frame, and
re-subscribes everything. Reconnects authenticate with the token from your latest
authenticate()call. - Resolution: on
market_resolvedit drops the outcome’s book and callsonMarketResolved. - Book watchdog: heartbeats only prove the connection is alive. Once a minute, the SDK checks
any book with no update for 5 minutes against
GET /orderbooks/outcomes(see Market-data API). A matchingseqmeans the market is just quiet. A differentseqtriggers a resnapshot, then a resubscribe if the next check still differs or the snapshot never arrives.
client.createWebSocket(), which the hooks and UI components
use too (always with the default timings). Each check costs one market-data quota unit per
silent outcome, and it pauses for Retry-After on a 429. With the SDK directly, tune or
disable it:
onDiagnostics:
Related
WebSocket Protocol
Wire format, sequencing, resnapshot requests, and heartbeat behavior.
Real-Time Charts
Build live candles from the same orderbook and trade streams.
User Notifications
Authenticated order and balance events on the same WebSocket connection.