0 Replies Latest reply on Sep 6, 2012 5:35 AM by Sven Plath

    Detect connection loss and restore

    Sven Plath Newbie

      Hi,

       

      i am designing a sample Errai application at the moment that needs to deal with connection losses to the server and how to restore in case the link is up again. These connection losses occur when links on the network go up or down, not when the whole server goes havoc. The network environment where the sample application should work in is not the most stable one.

       

      However, I know that i can handle connection losses by subscribing to the DefaultErrorCallback.CLIENT_ERROR_SUBJECT bus on the client as described in the user guide section 2.4 Handling Errors. It is important to detect a link up again as soon as the connection is restored. The client must sustain it's SessionID on an all-clients-bus so that no new initial configuration stuff must happen on the server. The SessionID is used to send messages on the bus to a particular subscriber.

       

      How can i detect that a link is up again out of my application the most useful way?

      • Should i try to send messages on a bus periodically until it stops failing?
      • Should i do some GWT RPC stuff to test for a new connection?
      • Something more useful?

      Furthermore, when the connection is up again, does the client keeps it's SessionID so i can map it directly to the IP address of the client? (The environment this sample works in uses static ip addresses on clients.). Or did I misunderstand the concept of the SessionID?

       

      I would love to do something like this:

      -> Client is connected

      -> Client detects connection loss

      -> Client goes into offline mode

      -> Client gets notified (no polling. Similar to DefaultErrorCallback bus) when the connection is restored

      -> Client goes into online mode with same SessionID so the server does not need to change it's configuration.

       

      Thanks in advance. Please tell me if i fundamentally misunderstood your concept here

       

      Greetings,

      Sven