> ## Documentation Index
> Fetch the complete documentation index at: https://public-perps-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# WebSocket

> WebSocket streaming via direct provider connections

Data is streamed via WebSocket connections **directly to the provider**, not through the LI.FI API. This provides the lowest possible latency for market data and user events.

<Info>
  If you're using the `@lifi/perps-sdk`, the [`PerpsWsClient`](/sdk/streaming) handles all connection management, subscriptions, and data normalization automatically.
</Info>

## Connection Discovery

The WebSocket URL for each provider is advertised via the `GET /providers` endpoint in the optional `wsUrl` field. Not all providers may support WebSocket — check for its presence before attempting to connect.

```
GET /v1/perps/providers
```

Connect directly to the returned `wsUrl`. The URL points to the provider's native WebSocket endpoint — message formats, available channels, and rate limits are provider-specific.

## Reconnection

If the connection drops:

1. Wait with exponential backoff (start at 150ms, double each attempt, max 10s)
2. Reconnect to the same `wsUrl`
3. Re-send all active subscriptions

The SDK's `PerpsWsClient` handles this automatically.

## Provider-Specific Protocol

Each provider has its own native WebSocket protocol, message formats, channels, and rate limits. See the provider pages for details:

* [Hyperliquid — WebSocket Protocol](/providers/hyperliquid/websocket)
* [Lighter — WebSocket Protocol](/providers/lighter/websocket)
