Allow WEBSOCKETS_MAX_DATA_SIZE to be overridden with a build flag - #989
Merged
Merged
Conversation
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.
WEBSOCKETS_MAX_DATA_SIZEis 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=32768now 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.