Results 1 to 4 of 4
  1. #1
    Power Member
    Join Date
    Nov 2012
    Posts
    182

    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?

  2. #2
    Power Member
    Join Date
    Nov 2012
    Posts
    182
    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.

  3. #3
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    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

  4. #4
    Power Member
    Join Date
    Nov 2012
    Posts
    182
    Yes that is useful info thanks.

 

 

Similar Threads

  1. Server start fails on Windows
    By UweF in forum General
    Replies: 1
    Last Post: November 19th, 2010, 11:41 AM
  2. Lightstreamer fails to start when run as a service
    By PeterHiross in forum General
    Replies: 2
    Last Post: August 25th, 2010, 04:27 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 09:06 AM.