feat(web): Implement WebSocket Broadcaster#98
Conversation
… Implemented client management with add/remove methods that are thread-safe, JSON formatting for stream data.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #98 +/- ##
======================================
Coverage ? 87.76%
======================================
Files ? 7
Lines ? 237
Branches ? 0
======================================
Hits ? 208
Misses ? 29
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| broadcast_interval: Time between broadcasts in seconds. | ||
| """ | ||
|
|
||
| CLIENT_SEND_TIMEOUT: float = 1.0 |
There was a problem hiding this comment.
This will move to config if we decide to keep it and if we want to make it tunable for users. Used in _broadcast_to_clients() and stop() timeout calculations, currently set as 1.0, which is pretty conservative.
that were pinned to 3.25.0. Using 'latest' for future-proofing. Use $(brew --prefix)/lib to support both Intel (/usr/local) and Apple Silicon (/opt/homebrew) architectures. This resolves pylsl failing to find liblsl binary due to macOS SIP stripping DYLD_* variables during subprocess propagation.
|
CI was failing on macOS because Homebrew’s lsl formula now installs LSL.framework (not liblsl.dylib), so pylsl couldn’t locate the native library during test collection. The setup action now detects the framework binary and exports Windows CI was slow and brittle because it built liblsl from source (CMake/toolchain churn). The setup action now downloads the prebuilt release zip and sets PYLSL_LIB + PATH after verifying lsl.dll exists. |
Asanto32
left a comment
There was a problem hiding this comment.
Some small comments, add unit tests for the first few functions, remove _run _broadcast_to_clients for separate/later PRs
Task
Create the Broadcaster class for real-time data streaming to browser clients. This core component reads data from the presenter and broadcasts it as JSON frames to all connected WebSocket clients.
Description
This PR introduces the
Broadcasterclass as the foundation for web-based visualization. It implements:Changes
__init__.pyfor the web submodulebroadcaster.pycontaining theBroadcasterclass with:start()/stop()lifecycle methodsadd_client()/remove_client()for connection managementformat_frame()for JSON serialization_run()broadcast loop with presenter polling_broadcast_to_clients()with async-to-sync bridge for WebSocket sendspyproject.tomlto addwebsockets>=14.0dependencyRelated Issues
#86