B4J Question jServer - detect websocket disconnect

alwaysbusy

Expert
Licensed User
Maybe you can play with some settings of jServer (after the jServer.start)

B4X:
...
srvr.Start

Dim joServer As JavaObject = srvr
   
Dim secs As Long = 60 ' must be defined as a long, else you get a 'java.lang.RuntimeException: Method: setIntervalSec not matched.' error
joServer.GetFieldJO("context").RunMethodJO("getSessionHandler", Null).RunMethodJO("getSessionIdManager", Null).RunMethodJO("getSessionHouseKeeper", Null).RunMethod("setIntervalSec", Array As Object(secs))
   
Dim jo As JavaObject = srvr
Dim connectors() As Object = jo.GetFieldJO("server").RunMethod("getConnectors", Null)
Dim timeoutMs As Long = 5*1000
For Each c As JavaObject In connectors
       c.RunMethod("setIdleTimeout", Array(timeoutMs))
Next
 
Top