WebSocket Realtime API
Establish a persistent connection for real-time counter events.
Endpoint
Authorization: Bearer token header required.
Example:
Protocol
Server -> client messages follow JSON-RPC 2.0 notification format (no id).
Fields:
jsonrpc: always "2.0"
method: event identifier (values below)
params: object with event-specific fields (camelCase)
Unknown methods or fields MUST be ignored for forward compatibility.
Events
counterUpdated
Complete state change (value and/or metadata) of a counter.
Params:
counterId (UUID)
displayName (string, optional if unchanged)
data (object|null; see Data Models)
counterDeleted
Counter removed or no longer accessible.
Params:
counterId (UUID)
counterMemberlistChanged
Member list changed (added/removed member).
Params:
counterId (UUID)
Ordering & Delivery
Order preserved per connection.
No exactly-once guarantee; client logic must be idempotent.
Duplicate semantic updates (e.g. multiple counterUpdated with same data) should be coalesced by client.
Reconnect Strategy
Use exponential backoff (1s,2s,5s,10s,30s) and re-sync via GET /v1/counters after reconnect to cover missed events.
Compatibility
Additional methods may appear at any time.
Ignore unknown methods and params fields.
Security
One authenticated user per socket.
The access token is never included in message payloads.