Extend WebSocket server with bidirectional custom characteristic commands #706
+142
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The WebSocket server on port 8080 was previously unidirectional (logging only). This change enables full bidirectional communication for custom characteristic commands using the same protocol as BLE, with responses sent back through the WebSocket connection.
Changes
WebSocketAppender: Added bidirectional message handling
onMessagecallback on client connectionBLE_ss2kCustomCharacteristic::process()BLE_Custom_Characteristic: Send responses via WebSocket
webSocketAppender.SendResponse()after setting characteristic valuesMain.h: Added extern declaration for webSocketAppender to enable cross-module access
Documentation: Updated
CustomCharacteristic.mdto document WebSocket as a fully bidirectional access method alongside BLE and DirConUsage
Custom characteristic commands now have three access paths with full bidirectional communication: BLE (direct), DirCon (TCP/8081), and WebSocket (8080). All three use the same processing logic via
BLE_ss2kCustomCharacteristic::process()and send responses back to clients.Note: Only WebSocket clients that have sent at least one command will receive command responses. Clients that only listen for logs will continue to receive text log messages but not binary command responses.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.