WebSocket Overview
Senticore streams market data and account events over JSON WebSocket
connections. This page and the three that follow are written against the
running gateway (ws_private.rs, ws_protocol.rs, public_ws_subscribe.rs)
and the TypeScript SDK (SenticoreWsClient, ReliablePrivateStream). Where an
older page showed op/channels frames or symbol-based market names, that
protocol never shipped; the frames below are the ones the gateway accepts.
Stream families
| Family | Endpoint | Auth | Channels |
|---|---|---|---|
| Multiplexed public | wss://api.sentico-labs.xyz/api/v1/ws/public | none | marketSnapshot, l2Book, trades, bbo, activeAssetCtx |
| Multiplexed private | wss://api.sentico-labs.xyz/api/v1/ws/private/{account} (aliases /api/v1/ws/mm/{account}, /api/v1/ws/bsl/{account}) | spws1… session token sent in an auth frame | account, userEvents, orderUpdates, userFills, dropCopy |
| Snapshot + delta market feed | wss://api.sentico-labs.xyz/api/v1/feed/public, redundant lines /feed/public/a and /feed/public/b | none | Sequenced full-book snapshot and deltas with per-frame checksums; carries the placement status frame — see Market Feed |
| Server-Sent Events | https://api.sentico-labs.xyz/api/stream/market, …/api/stream/account/{account} | none / private token | Fallback for environments without WebSocket |
{account} is the 20-byte engine account in hex. Market identifiers on every
channel are numeric marketId values from GET /api/v1/public/exchange-info,
never display symbols.
What every connection gets
- The first frames announce the stream schema and the session policy. The
session frame (
"event": "session") carries the heartbeat interval, the auth deadline, subscription limits and the reconnect policy. Read those limits from the frame instead of hard-coding them. - Every data frame carries
channel,seqandprev_seq. Sequence scope is per market on public channels and per account on private channels. - Cursor resume: subscribe with
fromSeq(aliascursor) and the server replays what it still retains, then sendssnapshot_end. Outside the retention window it answersresume_requiredand you rebuild from REST. - A
rotateframe beforerotateByMsasks you to reconnect gracefully and includes a resubscribe journal. - Control frames (
ack,error,warning) share the envelope of data frames.
Client responsibilities
- Verify
seq == prev_seq + 1per channel scope; on a gap, stop applying and resync. - Persist the last processed private
seqper channel and resume from it. - Optionally send
{"method": "ping"}; the server answers with anackon channelpong. Server heartbeats need no reply. - Reconnect with exponential backoff and jitter; the session frame's
reconnectPolicycarries the server's base and maximum backoff. - Keep public market recovery separate from private account recovery.