Jump to content
Sign in to follow this  
zedd

Lightstreamer DISCONNECTED:WILL-RETRY

Recommended Posts

Dear community,

I'm trying to establish connection with Lightsrteamer using JavaScript library. First problem which i was able to resolve is getting js library for Lightstreamer server version 5. Unfortunately i could not find compatible client library version in npm, so only option for me for now is this generator.

For investigation i'm using following code

request
      .post('https://ciapi.cityindex.com/tradingapi/session')
      .set('Accept', 'application/json')
      .send({
        UserName: USERNAME,
        Password: PASSWORD,
        AppKey: APPKEY,
        AppVersion: '1',
        AppComments: ''
      })
      .end((err, res) => {
        this.setState({ sessionId: res.body.Session })

  		var lsClient = new Lightstreamer.LightstreamerClient("https://push.cityindex.com/", 'STREAMINGALL');
        lsClient.addListener({
          onStatusChange: function (newStatus) {
            console.log('onStatusChange', newStatus);
          }
        });
        lsClient.connectionDetails.setUser(USERNAME);
        lsClient.connectionDetails.setPassword(res.body.Session);
        lsClient.connect();
      });

as you can see i use USERNAME and SessionId as password as Lightstreamer password.

In console i can see request to Lightstreamer to create a session:

POST https://push.cityindex.com/lightstreamer/create_session.js
with post data: 
LS_phase: 3157
LS_cause: timeout.2.0
LS_polling: true
LS_polling_millis: 0
LS_idle_millis: 0
LS_client_version: 6.1
LS_adapter_set: STREAMINGALL
LS_user: <CORRECT_USERNAME>
LS_password: <CORRECT_SESSION_ID>
LS_container: lsc

Response status code is 200

response body is:

/*
var myEnv = lsc;
var phase = null;
function setPhase(ph) {
 phase = ph;
}

function start(sID, addr, kaMs, reqLim, srv) {
 LS_window.LS_e(1, phase, sID, addr, kaMs, reqLim, srv);
}

function loop(holdMs) {
 LS_window.LS_e(2, phase, holdMs);
}
setPhase(3157);start('<SOME_IDENTIFICATOR>', 'PUSH1.CITYINDEX.COM', 0, 50000, 'Lightstreamer HTTP Server');loop(0);
*/

Lightstreamer library keeps sending POST /create_session.js requests every ~4 seconds

onStatusChange listener output is:

11:34:34.354 App.js:51 onStatusChange CONNECTING
11:34:39.343 App.js:51 onStatusChange DISCONNECTED:WILL-RETRY
11:34:39.346 App.js:51 onStatusChange CONNECTING
11:34:44.146 App.js:51 onStatusChange DISCONNECTED:WILL-RETRY
11:34:44.147 App.js:51 onStatusChange CONNECTING
11:34:49.349 App.js:51 onStatusChange DISCONNECTED:WILL-RETRY
11:34:49.350 App.js:51 onStatusChange CONNECTING
11:34:54.157 App.js:51 onStatusChange DISCONNECTED:WILL-RETRY
11:34:54.158 App.js:51 onStatusChange CONNECTING
11:34:59.246 App.js:51 onStatusChange DISCONNECTED:WILL-RETRY
11:34:59.247 App.js:51 onStatusChange CONNECTING
11:35:03.295 App.js:51 onStatusChange DISCONNECTED:WILL-RETRY
11:35:03.296 App.js:51 onStatusChange CONNECTING
11:35:07.952 App.js:51 onStatusChange DISCONNECTED:WILL-RETRY
11:35:07.954 App.js:51 onStatusChange CONNECTING
11:35:12.347 App.js:51 onStatusChange DISCONNECTED:WILL-RETRY
11:35:12.350 App.js:51 onStatusChange CONNECTING
11:35:16.380 App.js:51 onStatusChange DISCONNECTED:WILL-RETRY

If there are some chance to check logs, one of my session ids is 1c81dc88-a6cb-4086-ae7c-b7114860b3fa
At this point i expect to have well established connection. Obviously i'm doing something wrong in here.
Could you please suggest where to dig?

Thank you very much indeed
Cheers

Share this post


Link to post

Dear Physicsman,

Thank you for your suggestion.

Actually i'm not sure if this is issue of Lightstreamer. For the same code i can observe different behaviour when i reload the page.

Also most of times i can see message "License not valid for this Client version" and i'm sure that i use proper version of lightstreamer client. it's 

LS_client_version: 6.1

which is compatible with lightstreamer server v 5

And couple of times i was able to subscribe successfully to streamer.

As for me, this looks like different versions of application deployed on same load balancer or something like this.

Anyways, i'll keep watching "License not valid for this Client version" issue and keep this branch updated

Cheers!

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×