Lightstreamer Server tries to detect when a session has closed as soon as possible,
but it can't detect browser closure in real time.
Hence, we offer no better alternative to using
notifySessionClose(in couple with
notifyNewSession , which is better than
notifyUser to grab session start).
If you need to impose a strict check on the number of open sessions, our suggestion is that,
upon the reception of a request for a new session while another session is open,
instead of refusing the new request
you rather force the closure of the existing session and then accept the new request.
This technique allows for closing and reopening the browser by the user
and does not interfere with cases in which a new session is opened by LS client library in order to perform recovery actions.
If the user opens a new browser while another instance is still open, the currently open instance will get closed and will receive an asynchronous close notification through
onServerError;
the application should capture the notification: it may alert the user but it should keep from trying a new connection.
Is the above acceptable?
Notes on forcing session close can be found in
this post.