Skip to main content
@parlayx/sdk/stream is a typed WebSocket client for the ParlayX orderbook stream. It wraps the raw WebSocket API — the handshake, subscription bookkeeping, keepalive, and reconnect-with-resubscribe — behind a small createStreamClient surface, and delivers every server frame as a typed event. It ships inside @parlayx/sdk as the @parlayx/sdk/stream subpath, so there’s nothing extra to install — see Installation.

When to use it

Reach for the streaming client when you need live market data: a full orderbook snapshot followed by a continuous, gap-free stream of price-level changes, and optionally the market’s public trade tape. For everything else — placing and managing orders, reading balances, one-off market lookups — use the REST client from @parlayx/sdk. The two are complementary: stream prices in, route orders out.

What you get

  • Typed frames. on("snapshot", handler) hands you a fully typed SnapshotFrame; each event’s handler is narrowed to that frame’s shape.
  • Automatic resubscribe. Subscriptions are replayed on every reconnect, so a dropped connection is transparent to your application.
  • Keepalive & reconnect. Ping/pong liveness and exponential-backoff reconnect are built in.
Continue to Authentication to set up a stream key, then the Quickstart.