-
July 24th, 2014, 12:32 PM
#1
I want to test a LS connection and if it fails instantly try a different one
To explain further, my LS client software will contain various details about the LS server it needs to connect to.
One of the things it will be given is the hostname - but this will be a comma delimited list of hostnames for the connection to try, in sequence, until successful.
How do I achieve this efficiently? I want to try the first hostname, and as quickly as possible know if this is valid (connected) before moving on to try the next one if it is no good.
Normally, the LS client will gone into a "retry" loop if it fails to connect. Obviously I don't want that to happen while it is locating the correct hostname. I want it to try and if its is no good - fail and move on.
Once it finds a good one, I can then disconnect and reconnect with the normal parameters.
What options to I need to set to achieve this?
-
July 24th, 2014, 02:03 PM
#2
I think I have decided against this approach. It would be useful to know the suggestions, but the technique required in general to establish a connection is too asynchronous in its nature to be able to reliably cycle through a list to get a definitive connector.
-
July 25th, 2014, 10:05 AM
#3
Well,
since you would still have to hit the server to verify if you can connect or not, I would suggest to go with the LightstreamerClient connection, then listen for the DISCONNECTED* events and change the server on the connectionDetails element to try the next one ( http://www.lightstreamer.com/distros...tServerAddress )
Since both the events and the API calls are asynchronously executed, a new connection may be created before the server address setting is changed, so I would add an explicit disconnect call before changing the server and a connect call after it.
Note that the connection efforts might fail immediately or might remain pending. In the latter case a timeout is waited before giving up the connection. You could reduce such timeout ( http://www.lightstreamer.com/distros...ConnectTimeout )
Also, when connecting, the client by the default sends an http request and concurrently opens a websocket. You might want to delay the websocket ( http://www.lightstreamer.com/distros...yWSOpenEnabled )
HTH
-
July 29th, 2014, 01:15 PM
#4
Yes that is useful info thanks.
Similar Threads
-
Replies: 1
Last Post: November 19th, 2010, 12:41 PM
-
By PeterHiross in forum General
Replies: 2
Last Post: August 25th, 2010, 05:27 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 02:57 AM.
Bookmarks