I have this problem, most likely with the connection timeout WebSocket .
I have an ESP32 as an access point, where a simple code is loaded that turns the LED on or off. The LED is controlled by a remote transmitter (a simple HTML page with buttons to communicate, I use WiFi and the WebSocket mechanism - real time communication).
However, the transmitter, if it sends the command light the LED (10), sends the same command (10) every second so that the receiver knows that the button (a monostable button, releasing it turns off the power on the LED) is pressed all the time and so the LED is lit all the time. If the button is released, the receiver will receive a command to switch off the LED (00). If the transmitter loses communication and the receiver does not receive a command for 2 seconds, it switches off the LED itself. This is a safety mechanism.
There is a problem though, because if I press this button and hold it all the way down, after about 60 seconds the LED turns off on its own and after a few seconds the LED turns on again because the button is pressed, but I have figured out that these interruptions are caused by the WebSocket timeout. I've also noticed that it's as if the WiFi connection signalled on the panel is broken, even though the ESP32 is working, it doesn't reset, because activated with the right button the system on the ESP32 is still active.
Imagine a situation where you want to push a button to control the activation of the horn, so until I hold it down the horn works, if I release the button the horn stops buzzing. However, the interruptions described here mean that it is not possible to control a mechanism via the button for more than one minute, because after one minute the horn switches off automatically.
Someone has encountered something like this and has an idea how to solve the problem, most likely a timeout in WebSocket, as it is probably this mechanism that causes such situations.
I'm using the standard library to handle WebSocket
.
The ESP32 acts as an Access Point.
Generally I can't find the problem, because the longer I keep such a button active, then it seems like these connection breaks are more frequent, but I don't know if sending a command every second causes some kind of overflow on the ESP32, e.g. after a few minutes or what. The point is that the connection establishment on the panel should be stable, and I notice that the panel (HTML page) loses connectivity with the ESP32.
I have an ESP32 as an access point, where a simple code is loaded that turns the LED on or off. The LED is controlled by a remote transmitter (a simple HTML page with buttons to communicate, I use WiFi and the WebSocket mechanism - real time communication).
However, the transmitter, if it sends the command light the LED (10), sends the same command (10) every second so that the receiver knows that the button (a monostable button, releasing it turns off the power on the LED) is pressed all the time and so the LED is lit all the time. If the button is released, the receiver will receive a command to switch off the LED (00). If the transmitter loses communication and the receiver does not receive a command for 2 seconds, it switches off the LED itself. This is a safety mechanism.
There is a problem though, because if I press this button and hold it all the way down, after about 60 seconds the LED turns off on its own and after a few seconds the LED turns on again because the button is pressed, but I have figured out that these interruptions are caused by the WebSocket timeout. I've also noticed that it's as if the WiFi connection signalled on the panel is broken, even though the ESP32 is working, it doesn't reset, because activated with the right button the system on the ESP32 is still active.
Imagine a situation where you want to push a button to control the activation of the horn, so until I hold it down the horn works, if I release the button the horn stops buzzing. However, the interruptions described here mean that it is not possible to control a mechanism via the button for more than one minute, because after one minute the horn switches off automatically.
Someone has encountered something like this and has an idea how to solve the problem, most likely a timeout in WebSocket, as it is probably this mechanism that causes such situations.
I'm using the standard library to handle WebSocket
#include <WebSocketsServer.h>
The ESP32 acts as an Access Point.
Generally I can't find the problem, because the longer I keep such a button active, then it seems like these connection breaks are more frequent, but I don't know if sending a command every second causes some kind of overflow on the ESP32, e.g. after a few minutes or what. The point is that the connection establishment on the panel should be stable, and I notice that the panel (HTML page) loses connectivity with the ESP32.