Channel
Section titled “Channel”One joined topic.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
closed |
boolean |
|
joined |
boolean |
|
joinPayload |
Record<string, unknown> |
What the next (re)join sends; updated by the select* and watch helpers so a reconnect keeps them. |
joinRef |
string | null |
|
name |
string |
The topic without the user id, e.g. orders. |
onMessage |
MessageHandler | undefined |
|
pingIntervalMs |
number | null |
|
reply |
Record<string, any> |
The response object from the latest join reply, e.g. {selected_market_ids: null}. |
snapshots |
Record<string, any> |
The latest snapshot payload per snapshot event name. |
topic |
string |
The wire topic, e.g. orders:<user_id>. |
watches |
string[] |
Market ids watched on market_updates; re-sent after a reconnect. |
Methods
Section titled “Methods”[asyncIterator]()
Section titled “[asyncIterator]()”[asyncIterator](): AsyncIterator<ChannelMessage>Returns AsyncIterator<ChannelMessage>.
leave()
Section titled “leave()”leave(): Promise<void>Leave the topic. The channel stops receiving and its iterator ends.
Returns Promise<void>.
next()
Section titled “next()”next(timeoutMs?: number | null): Promise<ChannelMessage>The next message on this channel. Rejects with STXChannelException if
none arrives within timeoutMs or the channel closes.
| Parameter | Type | Description |
|---|---|---|
timeoutMs (optional) |
number | null |
Returns Promise<ChannelMessage>.
ping()
Section titled “ping()”ping(): Promise<any>Channel ping. On orders with cancel-on-disconnect armed this resets
the cancel deadline; on account and orders it keeps the session alive.
Returns Promise<any>.
push()
Section titled “push()”push(event: string, payload?: unknown, timeoutMs?: number): Promise<any>Send event on this channel and resolve to the reply’s response. Rejects when the reply status is error.
| Parameter | Type | Description |
|---|---|---|
event |
string |
|
payload (optional) |
unknown |
|
timeoutMs (optional) |
number |
Returns Promise<any>.
requestSeries()
Section titled “requestSeries()”requestSeries(marketIds: readonly string[], range?: string): Promise<any>market_stats: fetch history at range (day, week, month, all) without changing the subscription.
| Parameter | Type | Description |
|---|---|---|
marketIds |
readonly string[] |
|
range (optional) |
string |
Returns Promise<any>.
requestSnapshot()
Section titled “requestSnapshot()”requestSnapshot(): Promise<any>market:<id>: push the market’s current market_update and
order_book_update again now (after a gap, or to re-read a field).
Returns Promise<any>.
selectFilters()
Section titled “selectFilters()”selectFilters(filters: Record<string, readonly string[] | null>): Promise<any>ticker (sports, competitions) and trades (market_ids, event_ids): change filters without rejoining.
| Parameter | Type | Description |
|---|---|---|
filters |
Record<string, readonly string[] | null> |
Returns Promise<any>.
selectMarketIds()
Section titled “selectMarketIds()”selectMarketIds(marketIds: readonly string[] | null): Promise<any>Change the market_ids filter without rejoining. On orders, fills,
positions, settlements and account, null clears the filter;
orderbook and market_stats require at least one id.
| Parameter | Type | Description |
|---|---|---|
marketIds |
readonly string[] | null |
Returns Promise<any>.
selectMessageTypes()
Section titled “selectMessageTypes()”selectMessageTypes(messageTypes: readonly string[] | null): Promise<any>markets: receive market_created, market_updated or both.
| Parameter | Type | Description |
|---|---|---|
messageTypes |
readonly string[] | null |
Returns Promise<any>.
selectRuleFilters()
Section titled “selectRuleFilters()”selectRuleFilters(ruleFilters: readonly string[] | null): Promise<any>markets: change the rules filter; null disables it.
| Parameter | Type | Description |
|---|---|---|
ruleFilters |
readonly string[] | null |
Returns Promise<any>.
waitSnapshot()
Section titled “waitSnapshot()”waitSnapshot(timeoutMs?: number | null): Promise<Record<string, any>>Wait for the state-on-join and return it as {event: payload}. orders
gives {all_orders: {...}}; account waits for all four of its
snapshots. market_stats and market:<id> return the join reply, which
carries the series or the whole market. Channels with no snapshot (settlements, ticker, trades,
orderbook, markets, market_updates) throw.
| Parameter | Type | Description |
|---|---|---|
timeoutMs (optional) |
number | null |
Returns Promise<Record<string, any>>.
watch()
Section titled “watch()”watch(marketIds: readonly string[]): Promise<any>market_updates: start receiving created/updated for these markets.
Re-sent automatically after a reconnect.
| Parameter | Type | Description |
|---|---|---|
marketIds |
readonly string[] |
Returns Promise<any>.
ChannelMessage
Section titled “ChannelMessage”One pushed frame.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
event |
string |
|
joinRef |
string | null |
|
payload |
any |
The event’s JSON as documented for the channel; money and quantities are strings. |
ref |
string | null |
|
topic |
string |
The wire topic, e.g. orders:<user_id>. |
channel |
string |
The topic without the user id: "orders" for orders:<user_id>. |
isSnapshot |
boolean |
True for the state-on-join events (all_orders, balances, …). |

