Results 1 to 4 of 4
  1. #1

    Question How send information to stream by session or username

    Hi guys. I really need your help)

    I have an order data adapter on Node.js.
    How can I filter information for stream by userName or sessionId from Lighstreamer Session?

    For example: we have couple connections: user1, user2.
    I have private info for user1, but not for user2.

    I understand that metadata provider can help me, but how?

    Looking forward to your reply.

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi patrol90,

    You can leverage the getItems function (please refer to the Java API where the description is a little more expanded: https://lightstreamer.com/docs/adapt...a.lang.String-).
    The trick is that all the clients subscribe to the same Item, for example my_item, but your implementation of this method will return a different item name decorated with the user name or some other unique id for user or session.
    For example the method will return my_item_user1 and my_item_user2 respectively.
    Then your data adapter will handle these customized items, in order to send private messages to specific user.

    Please note that if you have mixed private and broadcast messages the getItems could return two Items one dedicated to the User and one public (ie. my_item_userX and my_item_public).

    Please let me know if you need any further clarifications.

    Regards,
    Giuseppe

  3. #3
    Hi Giuseppe.

    Great thanks!

    Works fine, great advice. First read I was confused, how I should return it, I tried with "return", after that I understood.
    Maybe my code will help somebody.

    this.metadataProvider.on('getItems', function(user, response) {
    response.success([`${itemName}_${user.userName}`]);
    });


  4. #4
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi patrol90,

    Thank you for sharing your code.

    Regards,
    Giuseppe

 

 

Similar Threads

  1. Replies: 1
    Last Post: June 7th, 2010, 12:13 PM
  2. Replies: 9
    Last Post: October 19th, 2009, 05:02 PM
  3. How to send params from client to server
    By kanibal210 in forum Client SDKs
    Replies: 1
    Last Post: September 30th, 2009, 09:36 AM
  4. Multiple Adaptors for one stream session
    By EWANG in forum Adapter SDKs
    Replies: 1
    Last Post: April 29th, 2009, 09:38 AM
  5. Send data back using LS
    By markgoldin in forum General
    Replies: 16
    Last Post: August 6th, 2008, 11:00 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:10 AM.