This question has been asked previously in ROS Answers.
We have seen that the web client stays quiet even if the connection with the rosbridge server breaks (such as WiFi disconnects). Therefore, it is essential to have a built-in feature, like a heartbeat topic, that a rosbridge client can use to detect the connection status.
The ROS class emits a close event when the connection get disconnected. You can use that.
I use that in my auto-ros wrapper, https://github.com/tue-robotics/auto-ros
Oh yeah. I completely forgot about the close event. It is there in my web app but just doing a console.log(), nothing else. Thanks for sharing the auto-ros wrapper.
This question has been asked previously in ROS Answers.
We have seen that the web client stays quiet even if the connection with the rosbridge server breaks (such as WiFi disconnects). Therefore, it is essential to have a built-in feature, like a heartbeat topic, that a rosbridge client can use to detect the connection status.