Results 1 to 2 of 2
  1. #1

    Subscription Challenges

    Hi trying to use LS with IG api and having trouble getting a subscription set up.

    Keep getting following error:

    Error encountered !
    Status code: unknown
    Error code: ReferenceError: subscription is not defined

    Can get data from API call no problem.
    Can connect to LS no problem.
    But setting up the subscription is proving very problematic.
    I've added the function code below if anyone can help much appreciated:
    // Now subscribe to the BID and OFFER prices
    var fieldList = ["bid","offer","updateTime","delayTime","marketStat us"];
    require(["Subscription"], function (Subscription) {
    // Set up Lightstreamer FIDs
    var subscription = new Subscription("MERGE","L1:IX.D.DAX.IFD.IP",fieldLis t)

    // Set up Lightstreamer event listener
    onSubscription: function () {
    onSubscriptionError: function (code, message) {
    console.log('subscription failure: ' + code + " message: " + message);
    onItemUpdate: function (updateInfo) {

    // Lightstreamer published some data
    // Add a new row to data table
    var marketStatus=getValue(marketStatus);
    var bidprc=getValue(bid);
    var offprc=getValue(offer);
    var delayTm=getValue(delayTime);
    var updTm=getValue(updateTime);
    var chg = "";

    $('#search_results_list').find('tbody:last').appen d(''+marketStatus+''+updTm+''+delayTm+''+bidprc+'' +offprc+''+chg+'');

    // Subscribe to Lightstreamer

  2. #2
    Join Date
    Feb 2012
    Hi kmm2908,

    It should be a problem about the scope of subscription variable; in your code it is visible only within the require block. Please try something like this:




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 04:26 AM.