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
The server has no generic unsubscribe. Forsubscribe_market_prices, re-emit the subscription with the remaining slug set; the server replaces the previous set:
ws.unsubscribe() in 1.1.0 emits an event the server does not handle and returns Err(LimitlessError::WebSocket("ack timeout after 5s")) while the server keeps streaming; avoid it.
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.