include/sig/feed/sig_signal_feed.h
#define SIG_SIGNAL_FEED_MODULE_NAME "signal_feed"
The live signal feed: streams the signals crossing chosen capsule terminals to WebSocket clients, as JSON text frames, on path "/feed" of the shared HTTP server (sig_http_server.h; same address and port as the REST API). SECURITY: the feed is UNAUTHENTICATED. The only check is the Origin header, done by the HTTP server (its cors_origin setting). Anyone who can reach the port can read live signal data of every terminal. Authentication is required before this ships; do not expose the port to untrusted networks. Register after sig_http_server_module() (and after sig_mgmt_http_module(), so the REST routes exist first); without the http server the runtime's start fails with SIG_ERR_NOT_FOUND. The module takes no config (NULL or ""; anything else is SIG_ERR_INVALID_ARG). Wire protocol (text frames, JSON): client: {"op":"subscribe","id":"<client string>","service":"S","instance":"I","terminal":"T"} {"op":"unsubscribe","id":"<client string>"} server: {"op":"subscribed","id":"X","dir":"in|out"} {"op":"error","id":"X","error":"bad_request|not_found|too_many"} (id omitted if absent) {"op":"signal","id":"X","seq":N,"t":<unix ms>,"type":"...","value":<json>} {"op":"dropped","id":"X","count":N} Subscriptions see only signals from the moment they are made (no history) and are keyed by names, so they survive a restart of the service. Limits: 8 connections (the 9th is closed with close code 1013), 16 subscriptions per connection (the 17th gets "too_many"), 4096 bytes per client frame, 1 MiB of unsent data per connection (beyond which signals are dropped and counted). Malformed frames close the connection with 1002 (protocol) or 1009 (too large); an invalid command gets an "error" reply and the connection stays. Threading: with a loop on the runtime (sig_runtime_set_loop) everything runs on that loop's thread; otherwise the module runs a private loop on one thread. The signal tap never blocks the emitting thread: when a subscription's queue is full, signals are dropped and counted.
const sig_runtime_module * sig_signal_feed_module()