Alaa
Alaa

Reputation: 831

Is there any way to check the status of connection to IBM WorkLight Server?

I'm working on a native iOS app that is using IBM Worklight server adapters.

Is there any function or any further way that let me able to know if I'm currently connected to the server (so my session is open and I can invoke my procedure immediately) or not then I need to establish new connection via WLClient().wlConnectWithDelegate(self) ?

Upvotes: 0

Views: 160

Answers (1)

Idan Adar
Idan Adar

Reputation: 44516

There is no such API provided by the Worklight framework.

The idea behind the connect API is to establish a session between the client and server, negating a possible occurrence of a race condition (for example two adapter requests to the server, each getting its own session, potentially causing trouble). This, in addition to delivering data on headers that is not available in an adapter request compared to connect request.

I think that instead of making a connect request before invocation you can do it in an early stage in the app's lifecycle, as well as whenever the app returns to the foreground, to ensure that a session was established. This, coupled together with an appropriate session timeout set in worklight.properties on the server-side.

More here: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/hello-world/connecting-to-the-mobilefirst-server/

Upvotes: 1

Related Questions