ArduinoWebsockets
ArduinoWebsockets copied to clipboard
ConnectionClosed when using _WS_CONFIG_MAX_MESSAGE_SIZE
I have somewhat huge messages passing trough a message bus, in this case it was around 200 kB. Without any modification the board segfaults trying to allocate memory. I tried setting the define i found _WS_CONFIG_MAX_MESSAGE_SIZE and set it to 1024. This got rid of the segfault but immediately triggers a WebsocketsEvent::ConnectionClosed after the huge message is sent.
To Reproduce Version: 8c391ce3e26fb0e1bfd1618984333095c9f74974 with #DEFINE _WS_CONFIG_MAX_MESSAGE_SIZE 1024 Board: ESP-01 Sending a message with 200kB of JSON.
Expected behavior Message to be ignored and connection remain open.
It's a good question and proposal.
There are few issues however. Mainly, how do you notify the user that a huge message arrived and that we skipped it?
I don't think there is really a perfect solution here, for your case I would recommend maybe using esp32, or patching the library exactly to your needs.
If you have a solution that is generic and you think better than the current state, feel free to submit a pull request.
Gil.