I handle a website which is designed in GWT and I want to check if internet connection goes down in between accessing the website. If internet is down I want to give message as cannot connect to server or something like Gmail handles it.
Can anybody suggest what will be the best way to handle this?
This is what the
onFailure(Throwable t)method onAsyncCallbackis for. This method is called when the RPC fails for any reason, including (but not limited to) loss of connection.Since the
Throwablethat gets passed intoonFailure()can be anything, the pattern used in the docs is:Specifically, a lack of internet connection will cause an
InvocationExceptionto be passed toonFailure()