# StreamHub — User Guide StreamHub turns signals streamed by MARTe2 `UDPStreamer` DataSources into a multi-user oscilloscope. One hub process aggregates any number of sources and serves up to 16 simultaneous clients: a browser SPA and/or the native ImGui desktop client. ``` MARTe2 app (UDPStreamer) ──UDP 44500──▶ StreamHub ──WebSocket 8090──▶ browser / ImGui ``` ## 1. Quick start (demo stack) ```bash source env.sh ./run_streamhub.sh -w -g ``` This builds everything, starts a demo MARTe2 application with three streamers (scalars over multicast, two array streamers), a StreamHub on port 8090, the web UI server on port 8080 (`-w`) and the ImGui client (`-g`). Then open: ``` http://localhost:8080/?hub=localhost:8090 ``` Useful flags: `-p ` WS port, `-n ` ring size, `-s` skip rebuild, `-h` full help (including the list of ports used). ## 2. Running against your own application 1. Add a `UDPStreamer` DataSource to your MARTe2 configuration (see [UDPStreamer.md](UDPStreamer.md)). 2. Write a hub configuration, e.g. `hub.cfg`: ``` WSPort = 8090 Sources = { MyApp = { Label = "MyApp" Addr = "192.168.0.10" Port = 44500 } } ``` For multicast streamers add `MulticastGroup = "239.0.0.1"` and `DataPort = 44503`. All keys and defaults: [StreamHub-Developer.md](StreamHub-Developer.md) §6. 3. Run the hub and a client: ```bash source env.sh ./Build/x86-linux/StreamHub/StreamHub.ex -cfg hub.cfg # web UI cd Client/webui && go build -o streamhub-webui . && ./streamhub-webui # then browse http://localhost:8080/?hub=:8090 # or native client ./Client/streamhub/build/StreamHubClient -host -port 8090 ``` A source can use TCP instead of UDP: add `Transport = "tcp"` (and `StreamName = ""` for a `TCPStreamService`). `StreamName = "a,b"` takes several streams over one connection, shown as separate sources `