+

Search Tips   |   Advanced Search

Connect to MobileFirst Server

By default, an application starts in offline mode. We can connect the application to MobileFirst Server either when it starts or at some appropriate point in its processing. The application maintains the offline or online state, and ensures that the application can recover from failed attempts to connect to the server. For example, before the application logs in a new user or accesses the server under a new user, the application must ensure that the server received a successful logout.

To make the application begin communicating with MobileFirst Server, use the WL.Client.connect method in common/js/main.js inside the WlCommonInit method. Call this method only once, before any other WL.Client methods that communicate with the server. Implement the onSuccess and onFailure callback functions.

For example:

UserPrefs are updated only after the call to the WL.Client.connect method.


Parent topic: Develop hybrid and web applications