Make WebSocket server port configurable#61
Open
jb1228 wants to merge 2 commits into
Open
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add configurable WebSocket server port (default 8928) across the project and update docs/examples: