IBM Worklight - Connecting/Re-Connecting: WL.Client.connect vs. connectOnStartup vs. WL.Client.invokeProcedure

淺唱寂寞╮ 提交于 2019-11-30 15:48:59
Anton

Though those three ways do have some similarities the differences between them are very important.

WL.Client.init() initializes client side WL framework.

WL.Client.connect() triggers connection request to WL server.

initOptions.connectOnStartup defines whether WL.Client.connect() will be invoked automatically during WL.Client.init().

In general - most of the functionality (e.g. adapters, remote disable) will function even if you call WL.Client.invokeProcedure() without calling WL.Client.connect(). But there are several things that will not function:

  1. You will not be able to fully utilize push notifications without calling WL.Client.connect()
  2. Direct update is triggered during WL.Client.connect()
  3. WL.Client.connect() will get security related info from server, e.g. names of realms, whether user authenticated in those realms etc. Therefore all APIs like WL.Client.getUserInfo, .isAuthenticated(), .getUserName() etc will not function.

It is strongly recommended to start your session with WL.Client.connect() (or initOptions.connectOnStartup=true).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!