# StreamHub WebSocket API StreamHub exposes a single WebSocket server (default port **8090**, any URL path). Text frames carry JSON commands/events; binary frames carry data pushes and trigger captures. The Go reference hub (`Client/udpstreamer`) implements the identical protocol; both the browser SPA and the ImGui client work against either. For the upstream UDPS wire format (source → hub) see [Protocol.md](Protocol.md). All numbers in binary frames are **little-endian**. All timestamps are **Unix wall-clock seconds** (float64) — see *Time base* in [StreamHub-Developer.md](StreamHub-Developer.md). --- ## 1. Commands (client → hub, JSON text frames) Every command is a JSON object with a `type` field. ### `ping` ```json {"type":"ping"} ``` Reply (unicast): `{"type":"pong"}`. ### `addSource` ```json {"type":"addSource","label":"PSU","addr":"192.168.0.10:44500", "multicastGroup":"239.0.0.1","dataPort":44503} ``` - `addr` — `host:port` of the UDPStreamer control port. - `multicastGroup` / `dataPort` — optional; if present the hub joins the multicast group for DATA and keeps a TCP control connection for CONNECT/CONFIG. - `transport` (`"udp"` default, or `"tcp"`) and `streamName` — for a TCP source, the `TCPStreamService` stream to subscribe to. A comma list (`"a,b"`) multiplexes several streams over one connection and adds one source per stream, labelled `