When I call a b4j_connect I understand a new instance of the corresponding websocket class is instantiated.
When does this instance gets destroyed: is there some kind of timeout ?
For example: a websocket gets created (and the WebSocket_Connected is called) but then no call is being made (indefintely) ?
Indeed this method is not called when the connection is not propertly closed.
For a server running 24/7 I guess there must be something to clean up these dangling connections ?
It will be eventually raised. If you want to have more control over it then run a JQuery method with a timer every few seconds. It will cause the logical connection to break if there is no actual connection.
It will be eventually raised. If you want to have more control over it then run a JQuery method with a timer every few seconds. It will cause the logical connection to break if there is no actual connection.
When the connection drops a timed jquery from the client will never reach the server (and would thus make no difference), but I guess you meant that the server is to check (also with a timer) that a heartbeat was received. If so: that's exactly what I am doing at this moment/
Sub Timer1_Tick
Try
Dim browserCheck as Future = ws.EvalWithResult("return null", Null)
Dim getValue as Object = browserCheck.Value
Log("Client browser reachable")
Catch
Log("Client browser NOT reachable")
End Try
End Sub
The websocket raises the disconnected event faster in my case ... tested with a timer interval of 10 seconds, connecting from my phone and turning Airplane mode ON.