B4J Question B4J webapp connection timeout issue

billzhan

Active Member
Licensed User
Longtime User
Hi all,

I've found that when a b4j websocket thread is not active for about 2 hours (in debug mode), the ws connection will be closed by server.

Logs (in red):
B4X:
Timeout on Read
Connection has been closed locally

I can refresh the page every 1 hour or so, but it will cause other problems.
How can I set the expiration time?


Thanks in advance.
bz
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
The inactivity timeout fires after 3 hours. It is important to eventually close inactive connections to avoid "collecting" broken connections.

If you want to disable it then you can use a timer that sends a request every few minutes. You can for example get the value of one of the elements. Don't forget to call ws.Flush.
 
Upvote 0

billzhan

Active Member
Licensed User
Longtime User
Thanks, Erel . It does the trick.

I find another issue for websocket thread which is not active for a long time. Session will also time out, and I have to set MaxInactiveInterval long enough .
B4X:
ws.Session.MaxInactiveInterval=86400*10 '10days
 
Upvote 0
Top