Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Mar 2010
    Location
    Madurai
    Posts
    12

    Client Server Disconnection Notification

    I have created a simple browser application with only one push page and two tables in it.

    I have solved most of the communication problems between the browser and the LS Adapters.

    I have only one major problem:

    I create the push page while logging in and I am setting the username and password in the same page. On the server side when the nofifyUser method gets called in the MetaDataAdapter, I am logging into my server application. The problem is when the client gets disconnected, I need to intimate my server application that the client has got disconnected. Currently I am not able to do it. But, If the client clicks on the logout button provided by me in the browser, I am able to capture this and send it to the LS using SendMessage from the client side and I am able to handle the same using notifyUserMessage in MetaDataAdapter and inturn send it to my server application. But if the users closes the browser window I am not sure in which event I should capture this event and send the logout message to my server application.

    I initially thought of using the notifySessionClose event. But this event gets fired in many scenarios. I also tried writing under notifyTablesClose event. This has the same problem as of notifySessionClose.

    Note: I have written a logic in the DataAdapter that if the user is already logged in, we will not allow the same user to login again. So while the browser is closed and opened again, I need to allow the user to login again. But currently since I am not able to trap it and I am send a message like, "User already logged in". I need to trap this browser close, remove the entry in the hashmap table present in the data adapeter, so that next time the user logs in I will allow him to log in.

    I hope I have given you a good brief on the problem. Please let me know the solution for the same.

    If you require any more information or clarification from me, please get back.

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    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.

 

 

Similar Threads

  1. disconnection problems
    By magnum_rg in forum Client SDKs
    Replies: 5
    Last Post: August 12th, 2011, 10:43 AM
  2. Replies: 1
    Last Post: June 23rd, 2011, 11:10 AM
  3. Track the Server disconnection
    By vaduganathan in forum Client SDKs
    Replies: 1
    Last Post: May 12th, 2010, 10:26 AM
  4. onSubscribe-Notification
    By lstest in forum Client SDKs
    Replies: 1
    Last Post: April 28th, 2009, 10:21 AM
  5. Replies: 5
    Last Post: December 13th, 2006, 09:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 10:37 AM.