Skip to main content
Each Lighter deployment advertises its native WebSocket endpoint through Provider.wsUrl: lighter uses the mainnet stream and lighter-rh uses the Robinhood stream. The same lighterWsProvider() factory binds to that provider-specific stream URL. For lighter-rh, also pass LIGHTER_RH_REST_URL so address-to-account-index lookups use the matching deployment. If you’re using normalized SDK channels, see Streaming.

SDK Channel Mapping

The SDK’s LighterWsProvider maps between normalized channel names and Lighter-native channels: Lighter does not expose a live OHLC channel. The SDK returns a no-op unsubscribe for candle subscriptions so chart UIs (rendering from REST history + price ticks) are not disrupted by a thrown error on every mount.

Authenticated channels

orderUpdates and positions require a Lighter auth token on every subscribe and reconnect. fills and accountSummary are publicly readable. When the matching REST plugin is registered on the same SDK client, the WebSocket provider automatically calls that plugin’s resolveAuthToken; no token callback or separate key store is needed.
Pass resolveAuthToken to lighterWsProvider({ resolveAuthToken }) only when constructing a standalone WebSocket client without the corresponding lighterProvider() or lighterRhProvider() on the same PerpsSDKClient. If neither source can produce a token, authenticated subscriptions fail at subscribe time.

Keepalive

The SDK sends a ping frame every 30 seconds to keep the connection alive.

Per-subscription dex field

When subscribing across providers, the per-subscription field that selects the venue is named dex (not provider). Use lighter for mainnet or lighter-rh for the Robinhood deployment.