IBM Worklight v5.0.5 > Develop IBM Worklight applications > Development guidelines for mobile environments

Connect to WL server


By default, applications are started in offline mode.

To have an application communicate with WL server on startup, set connectOnStartup in initOptions.js to true.

To have an application communicate with Worklight server at a later stage, call the method WL.Client.connect. Call this method only once, before any other WL.Client methods that communicate with the server. Implement onSuccess and onFailure callback functions.

WL.Client.connect(
{
    onSuccess: onConnectSuccess,
    onFailure: onConnectFailure
});


Parent Development guidelines for mobile environments


Related reference:

WL.Client.connect