STX.Sdk wraps each topic in a strongly-typed class you can register events on. Every channel takes care of:
- JWT attach on the connection URL
- 30-second heartbeat + auto-reconnect with exponential backoff
- Automatic resubscribe after reconnect
Available channels
| Channel | Topic | What it pushes |
|---|---|---|
STXPortfolioChannel | portfolio:{user_id} | Available balance, escrow, total P&L |
STXActiveOrdersChannel | active_orders:{user_id} | Order state transitions |
STXActiveTradesChannel | active_trades:{user_id} | Fills as they land |
STXActiveSettlementsChannelWrapper | active_settlements:{user_id} | Market settlements |
STXPositionsChannel | active_positions:{user_id} | Position changes |
STXUserInfoChannel | user_info:{user_id} | Profile/account updates |
STXMarketChannel | markets / market_info / market_updates | Market state + price ticks |
Connect a channel
ConnectAsync opens the socket (if not open), joins the topic, and registers handlers. It’s idempotent — calling it again is a no-op.
Portfolio channel
The smallest useful example — keep a live balance on screen:summary on join and update on every account-state change (order placed, order filled, deposit, withdrawal, settlement).
Active orders & trades
For a trading loop, you typically wire both:STXUserStorage automatically.
Market channel (price ticks)
Lifecycle
Channels are registered as singletons, so state (subscriptions, the underlying socket) is shared across your app. A typical startup sequence looks like:Reconnect behavior
If the underlying socket drops:- The SDK tries to reconnect with exponential backoff (250ms → 5s cap).
- On reconnect, every previously-joined topic is rejoined.
- Event handlers stay bound — no re-registration needed.
keepSessionAlive: true).
See also
- Authentication — why
keepSessionAlivematters for channels - Reference → Trading —
STXActiveOrdersChannelevent schemas

