Make WebSocket server port configurable#61
Conversation
These changes are primarily to allow multiple instances and keep default behavior at 8928.
Add configurable WebSocket server port (default 8928) across the project and update docs/examples.
- Add AGENTS.md project overview.
- Add DEFAULT_SERVER_PORT and server_port to SendspinClientConfig (include/sendspin/config.h).
- Pass configured server_port into servers via ConnectionManager (src/connection_manager.cpp) and add set_port()/server_port_ members to ESP and host ws_server classes (src/esp/ws_server.{h,cpp}, src/host/ws_server.{h,cpp}).
- Update host server to use server_port_ instead of hardcoded 8928 and log accordingly.
- Update examples (basic_client and tui_client) to accept -p PORT, parse/validate it, set config.server_port, and reflect usage/help text and README notes.
- Add docs entry for server_port in integration-guide.md.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR makes the WebSocket server port configurable (instead of hard-coded to 8928) and propagates that configuration through host/ESP server implementations, examples, and docs.
Changes:
- Added
SendspinClientConfig::server_port(defaulting to 8928) and a sharedDEFAULT_SERVER_PORTconstant. - Updated host and ESP WebSocket servers to use a configurable
server_port_(set viaset_port()and wired fromConnectionManager). - Updated example clients + documentation to expose/describe a
-p PORToption and advertise the chosen port via mDNS.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/host/ws_server.h | Adds configurable port storage + setter; updates comments to “configured port”. |
| src/host/ws_server.cpp | Uses server_port_ when constructing/logging the IXWebSocket server. |
| src/esp/ws_server.h | Adds configurable port storage + setter; updates capability docs. |
| src/esp/ws_server.cpp | Uses server_port_ in ESP httpd config. |
| src/connection_manager.cpp | Plumbs client_->config_.server_port into the WS server via set_port(). |
| include/sendspin/config.h | Introduces DEFAULT_SERVER_PORT and server_port config field. |
| examples/tui_client/main.cpp | Adds -p parsing and applies it to config + mDNS advertise. |
| examples/tui_client/README.md | Documents the new -p option. |
| examples/basic_client/main.cpp | Adds -p parsing and applies it to config + logs + mDNS advertise. |
| examples/basic_client/README.md | Documents default vs overridden port behavior. |
| docs/integration-guide.md | Documents server_port in the configuration table. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
kahrendt
left a comment
There was a problem hiding this comment.
One small nit change requested to help fix a mistake I previously made with padding. Overall, looks good!
- Reorder the `uint8_t` / `uint16_t` fields to avoid unnecessary padding
|
@jb1228 Sorry, I should have done this earlier, could you fix the clang-format stuff the CI is complaining about? I need to enable CI to run by default for all PRs so it won't wait on me to approve it! |
|
Thank you, @kahrendt! All your efforts on this project are very much appreciated! |
Add configurable WebSocket server port (default 8928) across the project and update docs/examples: