Page 1 of 1

websocket drop

Posted: Fri Feb 22, 2019 11:02 am
by NicoLuos
Hi everyone,
I'm working on a project with ESP32 on Arduino to create something like a bidirectional pipe between Serial2@1000000baud and WebSocket or BluetoothSPP. The code also manage connection stuff (WebServer, captive portal, mdns,...) to allow users to easily configure a wifi connection and name its ESP.
You can find my source code on this github : https://github.com/Luos-Robotics/ESP_Luos_pipe

Everything is kind of working, but I have a lot of trouble and strange crash with this code.
The most important one is Websocket drop.
If I connect my computer to the ESP websocket and send some JSON msg frequently after some time the ESP close the WebSocket connection.
I put my ESP in verbose mode, and I make a lot of test to try to get some leads about this, here are my observations :
1) If I my computer send something each 10ms, the Websocket just drop after few seconds absolutely no error appear on serial debug
2) If I my computer send something each 20ms, the Websocket maintain the connection a little bit longer but drop and an error appear :

Code: Select all

[E][WiFiClient.cpp:436] flush(): 11
3) If I my computer send something each 200ms, the Websocket drop after a long time and I get the same error.

I run those tests with different OS on different computers and different places with different people sending different messages with different languages.

Base on those leads I suspect 2 things :
1) Something like a buffer overflow on ESP
2) A "random" interrupt collision or something and I have more chances to get it if I send more WebSocket messages

Someone of you guys already have some issue like that ?
How can I fix this?
And if you don't know, how can I find more leads on this one?