Results 1 to 10 of 15

Hybrid View

  1. #1
    Hi, this is pretty much what I am doing, unfortunately I can't test it out with the Demo sample, but if you can take a look and let me know if this seems straightforward to you would be helpful! The reason I am following this approach is to not duplicate so much code.
    varls = require('lightstreamer-client-node');
    constconnect = (url, adapter) => {
    const lsClient = new ls.LightstreamerClient(url, adapter);

    lsClient.addListener({
    onStatusChange: (newStatus) => {
    console.log(newStatus)
    },
    });

    lsClient.connect();
    return lsClient;
    };

    var myClient1 = connect("https://push.lightstreamer1.com","WELCOME");
    var myClient2 = connect("https://push.lightstreamer2.com", "WELCOME")

    const lsSubscribe = (lsClient) => {

    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"));
    }
    });

    lsClient.subscribe(mySubscription);
    };

    lsSubscribe(myClient1)

    lsSubscribe(myClient2)
    Last edited by sdi0900; November 23rd, 2020 at 11:49 PM.

 

 

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