LucaMs Expert Licensed User Longtime User May 15, 2017 #1 Code: Copy 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 Erel said: Did you try it? Just add the timer in the server and run it. It worked properly here. Click to expand... 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. Last edited: May 15, 2017
Code: Copy 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 Erel said: Did you try it? Just add the timer in the server and run it. It worked properly here. Click to expand... 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.
LucaMs Expert Licensed User Longtime User May 15, 2017 #2 I tried exactly that code. Log: 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 ? Upvote 0
I tried exactly that code. Log: 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 ?
Erel B4X founder Staff member Licensed User Longtime User May 15, 2017 #3 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. Upvote 0
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.