If you’re using the
@lifi/perps-sdk, the PerpsWsClient handles all connection management, subscriptions, and data normalization automatically.Connection Discovery
The WebSocket URL for each DEX is advertised via theGET /dexes endpoint in the optional wsUrl field. Not all DEXes may support WebSocket — check for its presence before attempting to connect.
wsUrl. The URL points to the DEX’s native WebSocket endpoint — message formats, available channels, and rate limits are DEX-specific.
Reconnection
If the connection drops:- Wait with exponential backoff (start at 150ms, double each attempt, max 10s)
- Reconnect to the same
wsUrl - Re-send all active subscriptions
PerpsWsClient handles this automatically.