WebSocket Protocol
Senticore WebSocket channels use a multiplexed JSON protocol over a single TLS connection.
Connection
| Environment | Endpoint |
|---|---|
| Public beta streams | wss://stream.beta.sentico-labs.xyz/public |
| Private beta streams | wss://stream.beta.sentico-labs.xyz/private |
| Mainnet streams | wss://stream.sentico-labs.xyz after public launch |
Private streams require an authenticated handshake. See Authentication.
Message envelope
Every data message follows a stable envelope:
{
"channel": "l2Book",
"market": "BTC-USDC",
"seq": 184273,
"prevSeq": 184272,
"schemaId": "l2Book.v1",
"schemaVersion": 1,
"schemaEncoding": "json",
"ts": 1730000000000,
"data": {}
}
| Field | Purpose |
|---|---|
channel | Channel name |
market | Market identifier when channel-specific |
seq | Monotonic sequence within the channel scope |
prevSeq | Previous sequence used for gap detection |
schemaId / schemaVersion | Schema identity for compatibility checks |
schemaEncoding | json for current public streams |
ts | Server timestamp in unix milliseconds |
data | Channel-specific payload |
Subscribe and unsubscribe
{
"op": "subscribe",
"channels": [
{"channel": "l2Book", "market": "BTC-USDC"},
{"channel": "trades", "market": "BTC-USDC"}
]
}
Server acknowledgement:
{
"op": "subscribed",
"channels": [
{"channel": "l2Book", "market": "BTC-USDC"},
{"channel": "trades", "market": "BTC-USDC"}
]
}
Unsubscribe uses the same channel selector:
{
"op": "unsubscribe",
"channels": [
{"channel": "trades", "market": "BTC-USDC"}
]
}
Heartbeat
The server sends a heartbeat every 30 seconds:
{"op": "ping", "ts": 1730000000000}
The client must respond within 10 seconds:
{"op": "pong", "ts": 1730000000123}
Missed pongs close the connection.
Sequence handling
Consumers must:
- verify
seq == prevSeq + 1for every scoped stream - trigger resync on a gap, checksum mismatch, or
resync_required - fetch a fresh REST snapshot before applying new deltas
- resume private streams from the last acknowledged account sequence where available
Error model
Errors arrive as control messages:
{
"op": "error",
"code": "resync_required",
"channel": "l2Book",
"market": "BTC-USDC",
"message": "client lag exceeded retention window"
}
| Code | Client action |
|---|---|
resync_required | Fetch a snapshot, resubscribe, and replay from fresh state |
auth_failed | Reconnect with valid credentials |
rate_limited | Back off per retry guidance |
unknown_channel | Correct the subscription request |
permission_denied | Request the required account or institutional permission |
Resilience
See Reconnect Strategy for production-grade client behavior.