Results 1 to 7 of 7
  1. #1

    Question How to get SessionId in .NET client code?

    I have built a server adapter (in .NET using the ARI setup), which publishes updates for a bunch of items (one item for each session id connected). This should basically simulate unique messages for each connected client (from the same adapter). The session id is stored when the metadata adapter reports that a new session is created (NotifyNewSession called). I am trying to figure out how to subscribe to that item from the .NET client - basically I need the session id value on the client. I would assume that would be possible, but I cannot find the session id anywhere - it is not parsed in when OnSessionStarted is called in IConnectionListener and it is not available on the LSClient object. Is there any way to retrieve this on the client? (or some other way for the client to identify him self?)

  2. #2
    I can see that the JavaScript client gets the session id (LS_session) back, but it does not seem to be exposed anywhere, even though Fiddler shows: setPhase(6301);start('S57bc39904f51c4e2T5340330', null, 0, 50000, 'Lightstreamer HTTP Server');loop(0); It must be possible to use this session id on the client right? At least to corelate client and server events?

  3. #3
    Join Date
    Feb 2012
    The ID associated with the sessions of Lightstreamer Server is not made available to the client application (neither in JavaScript nor .NET client APIs), instead it is indicated in some callbacks of the Metadata Adapter, as you have already noticed, but in that case the purpose is just to connect subsequent notifications for the same session.

    In a scenario like yours that involves private messaging, a possible trick is to let the job do by the Metadata Adapter. Your clients can subscribe to the same Item name ("MyItem"), and in the getItems method of Metadata Adapter you can translate it in a private Item by pasting the sessionId ("MyItem-<SessionID>").
    Please refer to this thread too.

    About JavaScript library, you are right, the sessionID is sent to the client, but please consider that this is only for internal implementation, and that any application should not care about it.

  4. #4
    Thanks for the reply.

    I will try the solution suggested.

    BTW: The "enter" key does not Work when creating or editing a post reply in IE10 - that is why my 2 first posts do not have any line breaks.

  5. #5
    Join Date
    Jul 2006
    Milan, Italy
    Thanks for pointing out the IE10 issue! It should be fixed now. May you please confirm?


  6. #6
    It works in IE10 now (with IE9 standards document mode, but not with document mode set to "standards" in IE10 developer tools).

    I can't remember what the documents mode was the first time I stumpled upon this (but I changed browser mode to IE9 to fix it).
    Last edited by cwt237; September 18th, 2013 at 11:33 AM.

  7. #7
    Appending sessionId to the item name in the getItems method seems (and doing the same when publishing through the IItemEventListener seems to do the trick with handling private messages.




Tags for this Thread


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