Skip to content

Make WebSocket server port configurable#61

Merged
kahrendt merged 5 commits into
Sendspin:mainfrom
jb1228:websocket-port-config
Jun 4, 2026
Merged

Make WebSocket server port configurable#61
kahrendt merged 5 commits into
Sendspin:mainfrom
jb1228:websocket-port-config

Conversation

@jb1228

@jb1228 jb1228 commented May 26, 2026

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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>

@kahrendt kahrendt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One small nit change requested to help fix a mistake I previously made with padding. Overall, looks good!

Comment thread include/sendspin/config.h Outdated
jb1228 added 2 commits June 4, 2026 13:17
- Reorder the `uint8_t` / `uint16_t` fields to avoid unnecessary padding

@kahrendt kahrendt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@kahrendt

kahrendt commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@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!

@kahrendt kahrendt merged commit 024b455 into Sendspin:main Jun 4, 2026
5 checks passed
@jb1228

jb1228 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Thank you, @kahrendt! All your efforts on this project are very much appreciated!

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.

3 participants