0
votes

We are facing an issue with the client timeout where the failure call is not getting invoked.

The issue appears as the following:

  1. The user clicks on Sign in in our application.
  2. After 4sec the user is able to login successfully to the app.
  3. We recycle the Web services server and the user is taking 17sec to get the response back where it times out since we had set our time out to be 10000ms as our client requirements and it stays on the "Sign in" page without showing any error. On the second attempt to "Sign in" to the app, the response is coming in 4 sec and the app acts normally.

In the case of timing out we need to invoke a failure call to the user to inform him that error occurred and time out. but the call is not getting invoked:

initOption.js:

  var wlInitOptions = {
    .
    .
//  # Worklight server connection timeout
    timeout: 10000,
//  # Function to handle failure of Request Timeout
    onRequestTimeout : function (error) {
        WL.SimpleDialog.show(
                "System Error: Request Timeout",
                error,
                [{text: "Close", handler: null}]
        );
    },
.
.
};

Worklight version 6.2

Please let me know if extra code sharing is required.

Thanks

Edite:

Application flow:

once the user launch the application it will connect to WL server, the user then will click on sign in button which will trigger and adapter method "Login".

once the login process is done, it will do another call to get user data and fetch them to the device.

As I described, when the user click on Login the app will try to invoke the authentication function from the adapter. we have set the time out for the application to wait for the response back to be 10sec as mentioned in the coed above.

If the application didn't get the response back, then We need to show the user a dialog box with the appropriate text.

The issue is getting resolved if I increased the timeout from 10sec to 30 sec. However, I need to keep the timeout 10 sec and show the user a dialog box on timeout.

1
What happens when the user click on the "sign in" button? It does an adapter request or it does a connect()? It should not to a connect (implied by the code you use in initOptions.js, instead of regular onSuccess, onFailure in main.js instead). that is wrong implementation. You need to better describe your application flow.Idan Adar
We are calling an authentication adapter, and it does adapter request and not connect(). connect call is done through main.js which contains onSuccess and onFailure.Sami

1 Answers

0
votes

The timeout value mentioned in the code is between the client and the server, but there is an additional timeout, between the adapter procedure and the backend; you will want to have these properly synced/aligned/timed.

Are you using requestTimeoutInSeconds in the adapter XML?

Read more here: IBM Worklight 6.0.0.1 - Timeout setting in Adapters