Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16
  1. #11
    Member
    Join Date
    Aug 2008
    Location
    HCM City
    Posts
    7
    Quote Originally Posted by Alessandro
    There exist cases where you could decide to disconnect a user from Lightstreamer Server (for example if they log into a second session on a different Server and you don't want to support multiple push session for the same account;
    Option 3) Handle the termination on the client side. Your clients will subscribe to some "service item" through which your Data Adapter will deliver termination notifications to the clients. When a client receives such message, it will terminate its Lightstreamer session, disconnecting from Lightstreamer Server.
    This is our case: we want the server to disconnect all previous sessions of an user when he/she connects again (the same way as Yahoo Messenger does). And Option 3 sounds like a solution. Could you please explain a bit more details on how could I achieve this effect. Thank you.

  2. #12
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    Note that the "termination on the client side" technique was suggested for a java-based client.
    If your client were a web page, it might be easier for a malicious user to disable the mechanism.

    The idea is that the Data Adapter should manage special items that allow each single client session to subscribe to its own item, so as to receive its own notifications from the Data Adapter. For instance, the item names might be of the general form "<sessionID>_status".
    The client should only subscribe to a generic name like "session_status"; then, the Metadata Adapter, in getItems could generate the final name by leveraging session information.
    The Data Adapter might manage a single field for all those items (let's call it "allowed") and value it as "Y" or "N", according to your constraints.
    A client which found that the "allowed" field has a value of "N" should disconnect.

    Consider that the forthcoming 3.6 release of the Server will support a new "destroy session" request, as a milder replacement for the deprecated "kill all user sessions" feature.
    So, it will be possible to issue the request from any backend process that knows the active session IDs (by communicating with the various Metadata Adapter instances).
    However, the availability of the generic client SDK would be needed, which requires the Presto or Vivace version of the Server.

  3. #13
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    Lightstreaemer Server 3.6 release is now available.
    What follows is a sample code for forcing session termination from the Metadata Adapter, made possible by the new "destroy session" request.
    The sample can substitute the JMX based one shown earlier in this thread and represents a new implementation of Option 1 introduced above.

    So, we show a code snippet that, added to the Metadata Adapter code, listens to the notifications for session initiation and termination and causes each session to be closed after it has lived longer than five minutes.
    Upon forced session closure, the Web Client Library will enter "DISCONNECTED" state and won't try to recover the session; it will just notify application code through the "onServerError" event handler, with proper error codes.



    Note that the above code can only be used in Lightstreamer "Presto" or "Vivace" edition, in which the text interface is available.
    In "Allegro" or "Moderato" edition, we need to resort to the html or javascript interface; the following code snippet exploits the javascript case; the request syntax is the same, but for control.js in place of control.txt.




    Note that the response is in javascript and it is more complicated to analyze it.
    In case the operation is successful we should expect:

    On the other hand, if the session was not found we should expect:

    Any other response means that an unexpected condition has occurred.

  4. #14
    Senior Member
    Join Date
    Jul 2009
    Location
    not
    Posts
    41
    Hi Dario,

    How to do such thing, for example with the StockList Demo, knowing that this demo is using the default MetaAdapter ?
    Do i have to impelement one ?

  5. #15
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    Yes, the above code is not part of any available sample, so you should add it and recompile in order to test it.
    You can create a subclass of the default LiteralBasedProvider class, for instance.

  6. #16
    Senior Member
    Join Date
    Jul 2009
    Location
    not
    Posts
    41
    Thank you Dario.
    What i did is creating a new class, extending the default LiteralBasedProvider class and adding the lines (for destroying the session) in it.

 

 

Similar Threads

  1. Forcing session termination
    By Alessandro in forum General
    Replies: 6
    Last Post: February 7th, 2020, 03:03 PM
  2. disconnection problems
    By magnum_rg in forum Client SDKs
    Replies: 5
    Last Post: August 12th, 2011, 10:43 AM
  3. Track the Server disconnection
    By vaduganathan in forum Client SDKs
    Replies: 1
    Last Post: May 12th, 2010, 10:26 AM
  4. System.Security.SecurityException
    By gjoseph in forum Client SDKs
    Replies: 3
    Last Post: August 20th, 2009, 11:14 AM
  5. Internet Explorer --> Security zones issue
    By Mone in forum Client SDKs
    Replies: 0
    Last Post: July 30th, 2009, 10:09 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 11:38 PM.