Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Jul 2013
    Posts
    39

    Broadcast client connection status to others

    Hi,

    In my chat app, I need to show connection status of chat room members. What is best practice?

    Thanks in advance.

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    In Lightstreamer terms, the connection status of a user consists in whether or not there is an open session for that user.
    On the Server side, the Metadata Adapter can keep track of all the current sessions and their associated users by implementing notifyNewSession and notifySessionClose. In this way, the list of currently connected users can be updated in real time and it can be made available to the clients as an item in COMMAND mode.

    If you are interested in the presence of a user in a specific chat room, then the entrance and exit events are defined only by your application.
    We suggest leaning on the user entering and exiting the room by subscribing to and unsubscribing from a specific item (note that the subscription expires automatically when the session is closed). In this way, the Metadata Adapter is notified through notifyNewTables and notifyTablesClose.
    If your getItems implementation "decorates" the item to make it user-specific (a topic shown in other posts), you can also check when you receive the subscribe and unsubscribe calls in the Data Adapter. This takes advantage of subscription management and it is simpler to use, because, upon a sudden disconnection and reconnection (possibly due to a network problem), the subscription may remain active, with no interruption, because of the configured <subscription_timeout_millis>.

  3. #3
    Senior Member
    Join Date
    Jul 2013
    Posts
    39
    I understand. Thanks.

 

 

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 12:44 PM.