Results 1 to 10 of 15

Hybrid View

  1. #1
    Thanks for the reply, I have one more question. When subscribing to the same item through these two LS clients during the same user session, in the logs I am seeing always one or the other host giving updates. Is that expected behavior? I was hoping to receive one update at a time from both hosts. The only thing I changed from that Demo sample is instantiating a new LS object and call the other methods for each LS client. I am using the SimpleLogAppender to log client listener updates. I am new to this, so trying to understand if there is something between the listener or the logger that doesn't allow it differently, or is it me who is taking the wrong approach. Thanks!

    e.g Logs
    host1 - Connected:Streaming
    host2 - Connected:Streaming

    host1
    subscribed
    item update
    item update
    item update

    host2
    subscribed
    item update
    item update
    item update

    Why somewhere here there isn't:
    host1
    item update
    host2
    item update

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

    I am not sure if that could be a server-side issue or related to the client.
    But just to avoid misunderstanding please take a look at this example changed to get the same real-time data form two different Adapter Set.

    Code:
    var ls = require('lightstreamer-client-node');
    
    
    var myClient = new ls.LightstreamerClient("https://push.lightstreamer.com","WELCOME");  
    
    myClient.addListener({
      onStatusChange: function(newStatus) {         
        console.log(newStatus);
      }
    });
    
    myClient.connect();
    
    var mySnd = new ls.LightstreamerClient("https://push.lightstreamer.com","DEMO");  
    
    mySnd.addListener({
      onStatusChange: function(newStatus) {         
        console.log(newStatus);
      }
    });
    
    mySnd.connect();
    
    var mySubscription = new ls.Subscription("MERGE",["item1","item2","item3"],["stock_name","last_price"]);
    mySubscription.setDataAdapter("STOCKS");
    mySubscription.setRequestedSnapshot("yes");
    
    mySubscription.addListener({
      onSubscription: function() {
        console.log("SUBSCRIBED");
      },
      onUnsubscription: function() {
        console.log("UNSUBSCRIBED");
      },
      onItemUpdate: function(obj) {
        console.log("Fst - " + obj.getValue("stock_name") + ": " + obj.getValue("last_price"));
      }
    });
    
    myClient.subscribe(mySubscription);
    
    var my2S = new ls.Subscription("MERGE",["item1","item2","item3"],["stock_name","last_price"]);
    my2S.setDataAdapter("QUOTE_ADAPTER");
    my2S.setRequestedSnapshot("yes");
    
    my2S.addListener({
      onSubscription: function() {
        console.log("SUBSCRIBED");
      },
      onUnsubscription: function() {
        console.log("UNSUBSCRIBED");
      },
      onItemUpdate: function(obj) {
        console.log("Snd - " + obj.getValue("stock_name") + ": " + obj.getValue("last_price"));
      }
    });
    
    mySnd.subscribe(my2S);
    Please confirm that your version is something very similar.

    Thank you,
    Giuseppe

 

 

Similar Threads

  1. How to use multiple adapters in one web client
    By sjohn in forum Client SDKs
    Replies: 11
    Last Post: January 23rd, 2015, 11:22 AM
  2. Single data provider and multiple data sources
    By pluczak in forum Adapter SDKs
    Replies: 1
    Last Post: April 26th, 2012, 10:50 AM
  3. .NET Client Multiple Subscriptions
    By wwatts in forum Client SDKs
    Replies: 4
    Last Post: February 16th, 2010, 08:58 AM
  4. Deploying Demos in different servers
    By sarbao in forum Adapter SDKs
    Replies: 1
    Last Post: April 20th, 2009, 09:29 AM
  5. Replies: 3
    Last Post: February 8th, 2007, 09:11 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:20 PM.