Documentation Index
Fetch the complete documentation index at: https://limitless-docs-ws-settlement-events.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheWebSocketClient provides real-time streaming of orderbook updates and price data over a persistent WebSocket connection. It supports automatic reconnection and event-driven message handling via decorators.
Setup
| Parameter | Type | Default | Description |
|---|---|---|---|
url | str | Required | WebSocket server URL |
auto_reconnect | bool | True | Automatically reconnect on disconnection |
reconnect_delay | int | 5 | Seconds to wait between reconnection attempts |
Event Handlers
Register handlers for specific events using the@ws_client.on() decorator:
Available Events
| Event | Payload | Description |
|---|---|---|
connect | None | Fired when the WebSocket connection is established |
orderbookUpdate | dict | Orderbook changes (new bids/asks, removals) |
newPriceData | dict | Latest price data for subscribed markets |
Subscribing to Markets
After connecting, subscribe to specific markets to receive updates:subscribe() method takes two arguments:
| Parameter | Type | Description |
|---|---|---|
event | str | Subscription event name (e.g. "subscribe_market_prices") |
data | dict | Subscription parameters including marketSlugs |
Auto-Reconnect
Whenauto_reconnect is enabled (the default), the client automatically reconnects after a disconnection:
- The connection drops (network issue, server restart, etc.)
- The client waits
reconnect_delayseconds - A new connection is established
- The
connectevent fires again, so your subscription logic re-executes
Place your
subscribe() calls inside the connect handler to ensure subscriptions are restored after every reconnection.