WebSocket
WebSocket is the default transport for publish and subscribe.
Use the JavaScript or Rust SDK unless you are implementing a new language.
Connect
Open wss:// on the selected edge WebSocket URL from discovery. Production must use TLS.
Pass the access token:
Authorization: Bearer AT_...(non-browser)Sec-WebSocket-Protocol: llps.v1, at.AT_...(browser)
Handshake 401 means no usable token.
Framing (summary)
This is not a JSON RPC. Typical control lines are text:
- client
SUB:tenant:pattern - client
UNSUB:tenant:pattern - server
OK:SUB:.../OK:UNSUB:... - server
ERR:... - optional
PING/PONGfor socket RTT
Publish and deliver payloads are binary frames (v1 broadcast, v2 tagged delivery mode). The SDK encodes them. A handmade { "action": "subscribe" } JSON object will not work.
Details can change with protocol versions. Stay on the SDK.
Behaviour
- Invalid token: handshake 401 or immediate close.
- Forbidden tenant/channel:
ERR:...or drop, depending on the edge. - Slow consumer: disconnect.
- After reconnect: subscribe again (SDK does this).
See Error codes and Delivery semantics.