0
votes

We are configuring our app to connect to WL server on startup, but are having difficulties handling the different scenarios where WL server is not available (ex: offline mode).

connectOnStartup : false

The onConnectionFailure() callback is not called and the app remains frozen in the initialization process.

When we go with the manual connect, using WL.Client.connect(options) the onFailure handler is also not triggered.

Why are the failure handles not called and what is the best practice to ensure that the app is still functional when the WL server is not in reach, with just offline mode limitations and custom flows ?

1
They are called perfectly well here. Provide enough code and reproduction steps to see it.Idan Adar
Also, keep in mind that the onFailure will not be called until the timeout (whether the default one or the one specified by you) runs out, which is why it might seem that it is not called if you haven't waited enough for the timeout to run out.Daniel A. González

1 Answers

0
votes

Why are the failure handles not called

Both onConnectionFailure and WL.Client.connect's onSuccess & onFailure callback functions are working wonderfully here, so you really need provide more information if you expect to get any help in regards to this "issue".

what is the best practice to ensure that the app is still functional when the WL server is not in reach, with just offline mode limitations and custom flows

There is no "best" answer here. It depends on what are your expectations from your application based on the nature of the application. For every app it could be a different answer. Again, you did not provide any information...

  • Assuming you manage to figure out why onFailure is not called (maybe you should check for JavaScript errors in your code), then maybe you could disable any buttons in the application that would normally be clickable because they perform some action requiring backend connection.

    Because you are correctly not connected, you don't want the user to get errors - so disable the buttons.

  • You will also want to perhaps provide some additional visual feedback, like a custom message, a color DIV floating in the app UI, or just block the entire app - who knows. Depends on the context of the application(!).

  • "Custom flows"? Create them.