Topic
  • 1 reply
  • Latest Post - ‏2013-01-27T07:33:20Z by AntonAleksandrov
EUMC_Priyotosh_Ghosh
13 Posts

Pinned topic Worklight Offline problem

‏2013-01-25T08:28:26Z |
I am having some new issue with worklight. I just want to check whether my application is connected with the worklight server or not in the middle of my running application.
I mean after I go through two pages of my app I stop the worklight server and checking it whether it is connected or not. But when I am checking it I am still getting that the server is connected.
If I close the application and stop worklight server and then run the application that time it is not connected as expected.My used code is given below.
var isConnected = WL.Client.isConnected();
console.log(isConnected);
if(isConnected)
{
alert("Server is Connected");
customerList();
dialog();

}
if(!isConnected){

alert("Server is not Connected");
dialogOff();
}
I also used the following code but not getting any effect either.
//*********************************************//
document.addEventListener(WL.Events.WORKLIGHT_IS_CONNECTED, connectDetected, false);
document.addEventListener(WL.Events.WORKLIGHT_IS_DISCONNECTED, disconnectDetected , false);

function disconnectDetected(){

alert("Server is not Connected");
}

function connectDetected(){

alert("Server is Connected");
}
…………………………………………………………………………………………………………………………………..

I have one more issue with restful webservice.
I have created one restful web service and ran it with apache tomcat server.
I paste the war file inside webapps folder of apache server and running the server from another port no.
So, Can I execute the .war file from worklight server and if I can inside which folder I can paste it.

So, please give the feedback if it is done as I am stuck with it.
  • AntonAleksandrov
    AntonAleksandrov
    55 Posts

    Re: Worklight Offline problem

    ‏2013-01-27T07:33:20Z  
    First of all, this method is deprecated long time ago and an alternative exists:

    http://pic.dhe.ibm.com/infocenter/wrklight/v5r0m5/index.jsp?topic=%2Fcom.ibm.worklight.help.doc%2Fapiref%2Fr_deprecated_wl_client_isconnect.html

    But in general, WL.Client.isConnected() does not check current status of your server connectivity. It will return the status of last attempt to connect to WL server.
    In case server invocation failed, WL.Client.isConnected() will return false until some server invocation succeeds.

    Same for WL.Events.WORKLIGHT_IS_CONNECTED and WL.Events.WORKLIGHT_IS_DISCONNECTED events.