🔌 WebSocket Protocol
Cloud ↔ Station
The Station maintains a persistent WSS connection to Cloud. Two modes:
JSON-RPC over WS
Cloud and Station communicate via JSON-RPC. Cloud uses peer.call() to proxy mobile requests:
Two primitives:
peer.call(method, params)→ returnsPromise<result>(waits for matchingid)peer.notify(method, params)→ fire-and-forget (noid)
Backend ↔ Frontend (Local)
The Station Backend exposes a local WebSocket for the SPA frontend. Used for:
- Device state push (telemetry → UI in real time)
- Provisioning candidate updates (BLE flow)
- Connection status
Frontend subscribes via useWsSubscription hook (source).