Skip to main content
Get a dropped or lagging stream back to a state you can trust: reconnect, restore the subscriptions you track, and fill the interval you missed from replay or REST history. A new subscription streams from the moment it is accepted, so the interval before it has to come from replay or REST history.

Symptoms

  • The socket closes, or goes quiet, and your client stops receiving data.
  • After a reconnect, nothing arrives because the client never re-subscribed.
  • An error message with error_code slow_consumer arrives, and then a subscription stops sending or the socket closes.
  • A replay refuses replay.seek, or ignores speed.
  • A Free account receives no live data after its first 30 days.

Match the symptom to the cause

Reconnect and restore subscriptions

The server sends a ping frame every 30 seconds. A connection with active subscriptions can be closed after 60 seconds without activity, and one with no subscriptions after 300 seconds. Keep the subscriptions your client wants in one list, and send them again on every new socket. This Node.js client tracks Hyperliquid BTC trades, reconnects with capped exponential backoff and jitter, and records the newest trade time so it knows what it missed:
After a dropped socket, the client logs the close, waits, opens a new socket, and receives subscribed again with the time of the last trade it saw. Stop after a retry budget in production instead of reconnecting forever, and log the close code, retry count, and restored subscriptions. Keep-alive has the full sequence.

Handle lag notices

A connection that reads too slowly receives an error message with error_code slow_consumer. On Lighter, a connection that falls behind lighter_trades or the Lighter stats channels receives a notice counting the messages it missed, for example Dropped ~N live lighter_trades messages for BTC. Persistent lag stops that subscription until the client re-subscribes. A socket that stays behind across many sends on any channel is closed after a final slow_consumer message. What to do depends on the channel: Reduce the subscription set or move heavy work off the message callback before you re-subscribe, or the same lag returns.

Fill the interval you missed

Choose by what the job needs:
  • REST history returns the rows of a bounded window, ordered after retrieval. Request the missed trades from the last time you saw to now, page with meta.next_cursor, and drop rows you already hold. Hyperliquid trades return one row per side of each trade, so dedupe on trade_id and side. Troubleshoot pagination has the loop.
  • Standard replay sends stored events in order, starting at the start you give. end is optional and defaults to now; replay_started reports the effective window. The replay ends with replay_completed and does not follow new events, so keep the live subscription for anything after it. A live subscription and a replay can run on the same connection; a second replay while one is running is refused with conflict.
Lighter trade replay returns finalized trades only, up to meta.finalized_through, so the newest Lighter trades come from /v1/lighter/trades/{symbol}/recent instead.

L4 and full-depth replay rules

L4 replay (l4_diffs, l4_orders and the spot_, hip3_ and hip4_ variants) and full-depth replay (orderbook_full, hip3_orderbook_full) follow different rules from standard replay:
  • The server anchors the run to the latest checkpoint at or before start and opens with an l4_snapshot.
  • l4_batch messages follow: up to 5,000 order events per batch in block order on the L4 channels, and price-level changes in 100 ms windows of event time on the full-depth channels.
  • The stream can include updates before your start, to roll the checkpoint forward. Apply them before you score the study window.
  • speed is ignored, and each run is single-channel.
  • replay.seek is refused with unsupported_for_venue: replay.seek is not supported for L4 channels (restart the replay at the desired start instead). Send a new replay with the new start.

Verify the fix

  • Every tracked subscription has a subscribed acknowledgement on the current socket.
  • The filled interval runs from the last delivered time to the first live message, with no duplicate keys.
  • A replay ended with replay_completed, and any gap_detected event is recorded with the output.

Next step

Last modified on December 1, 2026