Skip to main content

πŸ”Œ 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) β†’ returns Promise<result> (waits for matching id)
  • peer.notify(method, params) β†’ fire-and-forget (no id)

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).

Reference​