Results 1 to 10 of 11

Hybrid View

  1. #1
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi Tim,

    Unfortunately the versions prior to 6.2.3 of lightstreamer-client package can not be obtained through "npm istall".
    So you should use the lightstreamer_node.js file and rely on an AMD loader (i.e.: require.js).
    Please refer to section "2.3.5.2 Using the AMD loader" of "JavaScript Client Guide" documentation, but in your case something like this should work:


  2. #2
    Sorry to bother you again Giuseppe. Perhaps this is one for Stack Overflow: Why would define still be undefined after requiring lightstreamer_node.js in the way you described above? From what I have read here: http://requirejs.org/docs/node.html requirejs should define define for me.

    I have installed requirejs
    Code:
    npm install requirejs
    and my code looks like this
    Code:
        var ls = {};
    
        IGInterface.prototype.connectToLightstreamer = function(loginCallback) {
          var requirejs;
          requirejs = require('requirejs');
    
          requirejs.config({
            deps: ["../thirdparty/lightstreamer_node.js"],
            nodeRequire: require
          });
    
          return requirejs(["LightstreamerClient", "Subscription"], (function(_this) {
            return function(LightstreamerClient, Subscription) {
              ls.LightstreamerClient = LightstreamerClient;
              ls.Subscription = Subscription;
              _this.lsClient = new ls.LightstreamerClient(_this.endPoint);
              _this.lsClient.connectionDetails.setUser(_this.clientId);
              _this.lsClient.connectionDetails.setPassword(_this.getPassword());
              _this.lsClient.addListener({
                onStatusChange: function(status) {
                  _this.showMessage("LS connection status: " + status);
                  if (status === "CONNECTED:WS-STREAMING") {
                    return loginCallback();
                  }
                }
              });
              return _this.lsClient.connect();
            };
          })(this));
        };
    the error is
    Code:
    /home/ubuntu/workspace/node_modules/requirejs/bin/r.js:2585
                        throw err;
                              ^
    Error: Tried loading "../thirdparty/lightstreamer_node.js" at ../thirdparty/lightstreamer_node.js then tried node's require("../thirdparty/lightstreamer_node.js") and it failed with error: ReferenceError: define is not defined
        at /home/ubuntu/workspace/node_modules/requirejs/bin/r.js:2578:27
        at Object.context.execCb (/home/ubuntu/workspace/node_modules/requirejs/bin/r.js:1929:33)
        at Object.Module.check (/home/ubuntu/workspace/node_modules/requirejs/bin/r.js:1129:51)
        at Object.Module.enable (/home/ubuntu/workspace/node_modules/requirejs/bin/r.js:1416:22)
        at Object.Module.init (/home/ubuntu/workspace/node_modules/requirejs/bin/r.js:1034:26)
        at callGetModule (/home/ubuntu/workspace/node_modules/requirejs/bin/r.js:1443:63)
        at Object.context.completeLoad (/home/ubuntu/workspace/node_modules/requirejs/bin/r.js:1822:21)
        at Function.req.load (/home/ubuntu/workspace/node_modules/requirejs/bin/r.js:2591:17)
        at Object.context.load (/home/ubuntu/workspace/node_modules/requirejs/bin/r.js:1918:21)
        at Object.Module.load (/home/ubuntu/workspace/node_modules/requirejs/bin/r.js:1080:29)
    I have tried reinstalling requirejs several times, deleting it in node_modules first and I've also re downloaded lightstreamer_node.js to make sure it's not been corrupted by me. Any ideas?

    Cheers,
    Tim

  3. #3
    I eventually fixed this. lightstreamer_node.js had to be in the same directory as the file I was writing: https://github.com/jrburke/requirejs/issues/122

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

    Good news, thank you for the feedback.

  5. #5
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,

    we just published version 6.1.4 on npm, so you can install the old version from there (and thus stop using the requirejs package)
    You can install the old version by using either
    npm install lightstreamer-client@6.1.4
    or
    npm install lightstreamer-client@legacy-server-5.1.2

    you can also obviously configure your package.json accordingly

 

 

Similar Threads

  1. Node.js client failing to connect in HTTP-STREAMING transport
    By david@theredx.com in forum Client SDKs
    Replies: 1
    Last Post: July 25th, 2013, 05:13 PM
  2. Benchmarking Socket.IO vs. Lightstreamer with Node.js
    By Alessandro in forum Adapter SDKs
    Replies: 0
    Last Post: June 3rd, 2013, 01:47 PM
  3. Replies: 0
    Last Post: May 9th, 2013, 03:33 PM

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:52 AM.