Overview
The Rust SDK provides a Socket.IO-basedWebSocketClient for:
- orderbook and trade streams
- market and price updates
- authenticated order, fill, position, and transaction streams
- automatic reconnect with subscription replay
Setup
Create a WebSocket client from the root SDK client:Connect and disconnect
WebSocketConfig
Event handlers
Useon() for raw JSON handlers, once() for one-shot handlers, and off() to unregister:
Typed handlers
The SDK also provides typed event handlers:Subscribing to channels
After connecting, subscribe to specific channels:The server answers every
subscribe_market_prices call, first or repeat, with one orderbookUpdate per CLOB slug carrying the full current book, including books with empty bids and asks. You do not need a REST call to seed local state. See Initial snapshot.Public channels
Authenticated channels
SubscriptionOptions
Unsubscribing
Updating credentials
You can rotate credentials at runtime:Auto-reconnect
Whenauto_reconnect is enabled, the client reconnects and replays saved subscriptions automatically.
The Rust client preserves normalized subscription options internally, so reconnects restore previous subscriptions without extra application code.