Skip to content

Make WebSocket server port configurable#61

Open
jb1228 wants to merge 2 commits into
Sendspin:mainfrom
jb1228:websocket-port-config
Open

Make WebSocket server port configurable#61
jb1228 wants to merge 2 commits into
Sendspin:mainfrom
jb1228:websocket-port-config

Conversation

@jb1228
Copy link
Copy Markdown

@jb1228 jb1228 commented May 26, 2026

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 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.

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.
Copilot AI review requested due to automatic review settings May 26, 2026 02:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 shared DEFAULT_SERVER_PORT constant.
  • Updated host and ESP WebSocket servers to use a configurable server_port_ (set via set_port() and wired from ConnectionManager).
  • Updated example clients + documentation to expose/describe a -p PORT option 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.

Comment thread src/host/ws_server.cpp Outdated
Comment thread src/host/ws_server.h
Comment thread examples/basic_client/main.cpp
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants