Skip to main content

Connection Steps

1. Open WebSocket

Connect to the Exit Intelligence Stream endpoint with your API key in the x-api-key header:

2. Receive hello_ok

Immediately after the connection opens, the server sends a hello_ok message:
The limits object reflects your tier’s capacity. See Rate Limits and Tiers for details.

3. Send configure

After receiving hello_ok, send a configure message with your wallets and strategy:

4. Receive Acknowledgement

The server responds with initial balance_update messages for tokens already held in the configured wallets. If a position is detected, you will also receive position_opened.

The limits Object

Reconnection

The SDKs handle reconnection automatically. When the WebSocket disconnects:
  1. The client waits with exponential backoff starting at 100 ms.
  2. Backoff doubles on each attempt up to a maximum of 2,000 ms.
  3. On successful reconnect, the client re sends the configure message.
  4. The server will re emit balance_update and position_opened events for existing holdings.
You do not need to implement reconnection logic yourself.

Ping and Pong

Client Ping

Send a ping to measure round trip latency:
The server responds with pong:

Server Ping

The server may also send WebSocket protocol level pings. The SDKs respond with pong frames automatically.

StreamClient vs StreamSession

StreamClient

The low level client manages the raw WebSocket connection:
  • Handles connect, reconnect, and message framing.
  • Returns raw ServerMessage objects from recv().
  • Provides a StreamSender for sending client messages.
  • Supports lane splitting via connectLanes() which separates high priority messages (exit signals, position events) from low priority messages (pnl_update).

StreamSession

The high level session wraps StreamClient with:
  • Position tracking: Automatically maintains a map of open positions by ID and token account.
  • Typed events: Returns StreamEvent objects with a PositionHandle attached.
  • Deadline timers: Automatically requests exit signals after deadline_timeout_sec.
  • Strategy updates: updateStrategy() and updateStrategyOptional() methods.
For most integrations, use StreamSession.

Lanes

Lane splitting separates the message stream into two receivers:
  • High priority lane: hello_ok, error, balance_update, position_opened, position_closed, exit_signal_with_tx
  • Low priority lane: pnl_update
This prevents high frequency PnL updates from blocking time sensitive exit signals. Lane splitting is currently available in the TypeScript SDK only via connectLanes():
When the low priority buffer is full, the oldest message is dropped to keep the Exit Intelligence Stream responsive.