Skip to main content

Install

Requires Node.js 18+. The ws package provides WebSocket support for Node.js.

Quick Start

REST Methods

Every REST endpoint has a typed method on the PolyNode client:

WebSocket Streaming

Subscribe to real-time events with a builder pattern:

Event Callbacks

Async Iterator

Subscription Filters

All filters from the Subscriptions & Filters page are supported:

Subscription Types

Multiple Subscriptions

Subscriptions stack on the same connection:

Compression

Enable zlib compression for ~60% bandwidth savings:

Auto-Reconnect

Enabled by default. The SDK reconnects with exponential backoff and replays all active subscriptions:
In TypeScript SDK v0.10.17+, event subscriptions also preserve frames that arrive before the subscribe acknowledgement, so attaching handlers immediately after await ...send() will still receive the initial snapshot/live frames. Orderbook subscriptions use the same 30s default subscribe timeout and replay the active token list on reconnect without replacing handlers.

Cleanup

Configuration

Error Handling

TypeScript Types

All event types are exported and fully typed:

Source

GitHub | NPM