Closed psykovski-extended closed 2 years ago
That looks like a very tight loop. I expect you are running out of memory or something, the ESP32 is a very slow machine with only a small amount of memory. What happens when you use a delay of one or more seconds between sends?
Lack of memory can not be the error, because ESP32 would then raise an error. It actually worked a view weeks ago, the only thing i changed, was that there is a timer, which runs every 16ms and the ISR takes about 10ms to terminate. This is what the loop is for in publish_data()
.
The delay is regulating itself, because it waits til the data is sent. The thing that concerns me is that when the timer isr takes lesser time to terminate, it works perfectly, but how could those tasks interfere with each other?
Solves the issue:
The problem wasn't the client side, it was a server side problem. The server wanted to receive a keep-alive-ping ever 5s, If IT doesn't receive it, the connection gets dropped.
I've wrote a little program, where I continuously send data to my WebSocket Server:
The connection is not lost, because of not sending any data, it just happens every 5s or so. This code runs on an ESP32. Does anyone know, why this could happen?