0
votes

I have a Worklight 6.1.0.1 hybrid app that I'm running on iOS. The app uses adapter-based authentication. The app prepares the invocation data makes the following call when the Login button is clicked:

singleStepAuthRealmChallengeHandler.submitAdapterAuthentication(invocationData, {});

If the WL service is down, or if the mobile device has no network access, the invocation will timeout. I see the following in the Xcode console:

defaultOptions:onFailure Request timed out for http://myipaddress:10080/myapp/apps/services/../../invoke. Make sure the host address is available to the application (especially relevant for Android and iPhone apps).

How can I capture this timeout event, so that I can update the UI with a proper message?

1

1 Answers

0
votes

Update May 23rd based on comments:

What is your exact flow?

You should first use WL.Client.connect({onSuccess: ..., onFailure:...});
If connection to the server is successful, you will enter the challenge handler. Otherwise, you will enter onFailure and there you can create the custom error handling.


Previous answer attempt:
The below is when trying to connect() to the Worklight Server.

If you want custom handling for when the client fails connecting to the server I believe you need to enable and use the option onConnectionFailure in initOptions.js:

var wlInitOptions = 
// # The callback function to invoke in case application fails to connect to Worklight Server
    //onConnectionFailure: function (){},

}

Otherwise, Worklight's default dialog will be displayed.