Overview
The Bison API provides real-time market and event data streams via WebSockets. This allows you to receive updates as they happen, rather than polling for updates at fixed intervals.Available WebSocket Endpoints
Bison provides three WebSocket endpoints for different use cases:User Events
Receive updates about your orders, positions, and balances
Market Tickers
Stream live market data for all markets in an event
Orderbook Data
Get real-time orderbook snapshots and deltas
Connection Pattern
All WebSocket endpoints follow the same connection pattern:Establish Connection
Connect to the WebSocket endpoint using the
wss:// protocol (or ws:// for local development).Heartbeat Mechanism
To keep connections alive, send a ping message every 30 seconds:Reconnection Strategy
When a connection closes unexpectedly, implement exponential backoff for reconnection:- First retry: 1 second delay
- Second retry: 2 seconds delay
- Third retry: 4 seconds delay
- Fourth retry: 8 seconds delay
- Fifth retry: 16 seconds delay
- Maximum retry: 30 seconds delay
Error Handling
WebSocket connections can fail for various reasons. Implement proper error handling:Best Practices
Next Steps
Explore the message formats for each WebSocket endpoint:- User Events - Order, position, and balance updates
- Market Tickers - Live bid/ask prices and volume
- Orderbook Data - Real-time order book depth