Skip to content

Allow WEBSOCKETS_MAX_DATA_SIZE to be overridden with a build flag - #989

Merged
Links2004 merged 1 commit into
Links2004:masterfrom
kakopappa:configurable-max-data-size
Sep 22, 2026
Merged

Links2004 merged 1 commit into
Links2004:masterfrom
kakopappa:configurable-max-data-size

Conversation

@kakopappa

Copy link
Copy Markdown
Contributor

WEBSOCKETS_MAX_DATA_SIZE is defined unconditionally for every platform, so a project that needs larger frames has to edit the library's header, and the edit is lost on every library update. A -DWEBSOCKETS_MAX_DATA_SIZE=... build flag currently only produces a redefinition warning.

This wraps each per-platform definition in #ifndef WEBSOCKETS_MAX_DATA_SIZE. Each platform keeps its current default, and a build flag such as -DWEBSOCKETS_MAX_DATA_SIZE=32768 now takes effect. The README line that mentions the limit says so.

An oversized frame closes the connection (payload too big!), which the far end sees as the client going offline. We hit this with WebRTC signalling messages of about 17 kB on ESP32.

Tested with arduino-cli: a sketch that static_asserts the value compiles with the default and with the flag on ESP32 (core 3.3.11) and ESP8266 (core 3.1.2), and fails as expected when the asserted value is wrong.

@Links2004
Links2004 merged commit 0013395 into Links2004:master Sep 22, 2026
43 checks passed
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