Hi,
I'm using LightStreamer to connect with IG Index (https://labs.ig.com/streaming-api-guide). I have succeeded using javascript in Chrome and now I am trying with node.js with very similar code. I can connect over http to "http://push.lightstreamer.com" without any authentication but I can't connection to https with a password. What am I missing? I am sure the endpoint, clientId and password are correct in that they are the same as the Chrome version which works. I keep getting:
Lightstreamer connection status:CONNECTING
Lightstreamer connection statusISCONNECTED:WILL-RETRY
Lightstreamer connection status:CONNECTING
Lightstreamer connection statusISCONNECTED:WILL-RETRY
Lightstreamer connection status:CONNECTING
Thanks for your help!
Tim
Node.js Code
Code:
ls = require("lightstreamer-client");
IGInterface.prototype.connectToLightstreamer = function(loginCallback) {
console.log("Connecting to lightstreamer");
this.lsClient = new ls.LightstreamerClient(this.lsEndpoint);
this.lsClient.connectionDetails.setUser(this.clientId);
this.password = "";
if (this.clientToken) {
this.password = "CST-" + this.clientToken;
}
if (this.clientToken && this.accountToken) {
this.password = this.password + "|";
}
if (this.accountToken) {
this.password = this.password + "XST-" + this.accountToken;
}
this.lsClient.connectionDetails.setPassword(this.password);
console.log(this.lsClient.connectionDetails);
this.lsClient.addListener({
onListenStart: (function(_this) {
return function() {
return _this.showMessage("Lightstreamer client - start listening");
};
})(this),
onStatusChange: (function(_this) {
return function(status) {
_this.showMessage("Lightstreamer connection status:" + status);
if (status === "CONNECTED:WS-STREAMING") {
return loginCallback();
}
};
})(this)
});
return this.lsClient.connect();
};
Bookmarks