Skip to main content

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

FamilyEndpointAuthChannels
Multiplexed publicwss://api.sentico-labs.xyz/api/v1/ws/publicnonemarketSnapshot, l2Book, trades, bbo, activeAssetCtx
Multiplexed privatewss://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 frameaccount, userEvents, orderUpdates, userFills, dropCopy
Snapshot + delta market feedwss://api.sentico-labs.xyz/api/v1/feed/public, redundant lines /feed/public/a and /feed/public/bnoneSequenced full-book snapshot and deltas with per-frame checksums; carries the placement status frame — see Market Feed
Server-Sent Eventshttps://api.sentico-labs.xyz/api/stream/market, …/api/stream/account/{account}none / private tokenFallback 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, seq and prev_seq. Sequence scope is per market on public channels and per account on private channels.
  • Cursor resume: subscribe with fromSeq (alias cursor) and the server replays what it still retains, then sends snapshot_end. Outside the retention window it answers resume_required and you rebuild from REST.
  • A rotate frame before rotateByMs asks 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 + 1 per channel scope; on a gap, stop applying and resync.
  • Persist the last processed private seq per channel and resume from it.
  • Optionally send {"method": "ping"}; the server answers with an ack on channel pong. Server heartbeats need no reply.
  • Reconnect with exponential backoff and jitter; the session frame's reconnectPolicy carries the server's base and maximum backoff.
  • Keep public market recovery separate from private account recovery.

Next