Private Sub WebSocket_Connected (WebSocket1 As WebSocket)
ws = WebSocket1
tmr.Initialize("tmr", 1000)
tmr.Enabled = True
End Sub
Sub tmr_Tick
ws.RunFunction("NOP", Null)
ws.Flush
Log("tick")
End Sub
Most likely I did not understand the purpose of that code .
I think that evey second the server tries to call a non-existing routine on the client but this fact does not raise an exception, since the websocket "seems" to be connected, so nothing should happen.
2017-05-15 12:53:55.544:INFOejs.Server:main: Started @1478ms
Update DuckDNS: OK
tick
tick
tick
tick
tick
tick
tick
' <--- here (probably) I turned off the client wifi
tick
tick
tick
tick
tick
Let it try to run for a few minutes and see whether it detects the disconnection.
If you need to have better control over the connection state then you will need to let the client reply and check the last reply time in the timer tick event. If more than 10 seconds passed then close the connection.