B4J Question Question about JServer Websocket Handle

Waldemar Lima

Active Member
Licensed User
Hi everyone !
i am learning about JServer Library [ WebSocket ] .
so i have a doubt about WebSocket Handle .

When connected user is "Disconnected" , session will be deleted automatically ? ( if not , how can i destroy this session ? )
 

LucaMs

Expert
Licensed User
When the websocket is disconnected... is disconnected, therefore the session is closed.

If you are asking about the websocket handler class instance it will be automatically destroyed if there are no references to it.
 

Erel

Administrator
Staff member
Licensed User
No. The session is not deleted when the user disconnects. The session is deleted when you call Session.Invalidate. You can also set Session.MaxInactiveInterval. This way the session will be deleted automatically when it is no longer active.
 

LucaMs

Expert
Licensed User
I still have to understand the Erel's answer :D (but I trust, of course).

Or, better, I understand his answer but I don't know what you can do with a session if the websocket is disconnected.
 
Last edited:

Erel

Administrator
Staff member
Licensed User
Or, better, I understand his answer but I don't know what you can do with a session if the websocket is disconnected.
Very simple. The user might reconnect again.

Sessions are especially useful with regular http requests as they allow you to maintain the state.
 
Top