Handling connection loss with websockets
You have to add ping pong method Create a code in server when receive __ping__ send __pong__ back JavaScript code is give below function ping() { ws.send(‘__ping__’); tm = setTimeout(function () { /// —connection closed /// }, 5000); } function pong() { clearTimeout(tm); } websocket_conn.onopen = function () { setInterval(ping, 30000); } websocket_conn.onmessage = function … Read more