Skip to main content

Module ws

Module ws 

Source
Expand description

Zero-dependency RFC 6455 WebSocket bridge for browser reach (docs/roadmap.md, step 13).

Browsers cannot open the raw UDP/TCP sockets of LSL. WsBridge adds an opt-in WebSocket endpoint (off by default, bound to 127.0.0.1 and accepting only loopback peers unless configured otherwise) that:

  1. Lists discovered LSL streams ({"op":"list"} or GET /streams).
  2. Subscribes a browser to any LSL stream ({"op":"subscribe",...}) and forwards exact LSL wire-encoded samples in binary WebSocket frames ([u32 stream_id LE][u32 count LE][LSL wire samples...]) for decoding by labstream-wasm, plus live meta/1 metadata updates as JSON text frames.
  3. Publishes browser markers ({"op":"marker",...}) onto a live LSL string marker outlet.

Structsยง

WsBridge
Running WebSocket bridge serving browser viewers and marker publishers.
WsOptions
Configuration for WsBridge::start.