Ibm mobilefirst Mobilefirst心跳示例。事件没有发生

Ibm mobilefirst Mobilefirst心跳示例。事件没有发生,ibm-mobilefirst,Ibm Mobilefirst,我已经从下面的链接导入了这个示例 我在wlCommonInit()中添加了一个WL.Client.connect() 启动应用程序时,控件按以下顺序流动 WL.Logger.debug("I am inside the WL Common Init"); Registeres the WL.Events. WL.Logger.debug("connectDetected called"); WL.Logger.debug("Inside the connect-onSuccess"

我已经从下面的链接导入了这个示例

我在wlCommonInit()中添加了一个WL.Client.connect()

启动应用程序时,控件按以下顺序流动

WL.Logger.debug("I am inside the WL Common Init");  
Registeres the WL.Events.  
WL.Logger.debug("connectDetected called");  
WL.Logger.debug("Inside the connect-onSuccess");
但是当调用setHeartBeatInterval()方法时。它没有再次调用connectDetected()方法吗

有人能帮我理解为什么在调用setHeartBeatInterval()之后不调用connectDetected()方法吗

函数wlCommonInit(){
WL.Client.connect({
onSuccess:OnConnect成功,
onFailure:onConnectFailure
}); 
函数onConnectSuccess(){
WL.Logger.debug(“在connectonsuccess内部”);
}
函数onConnectFailure(){
WL.Logger.debug(“连接失败内部”);
}
debug(“我在WL公共初始化中”);
document.addEventListener(WL.Events.WORKLIGHT_已连接,已检测到连接,错误);
document.addEventListener(WL.Events.WORKLIGHT_已断开连接,检测到断开连接,错误);
}
函数连接失败(){
警报(“无法连接到MobileFirst服务器”);
变量输出=新日期()+“
脱机工作”; $('#info').html(输出); } 检测到函数断开(){ 变量输出=新日期()+“
检测到断开连接”; $('#info').html(输出); } 函数connectDetected(){ 调试(“connectdetectedcalled”); var output=new Date()+“
connectDetected”; $('#info').html(输出); } 函数setHeartBeatInterval(间隔){ var output=new Date()+“
心跳间隔设置为:“+interval; $('#info').html(输出); WL.Client.setHeartBeatInterval(interval); }
您希望它什么时候再打电话?

关闭服务器并再次启动,它将检测到与服务器的连接,然后会被调用。

因此,当应用程序已连接到服务器时,通过调用setHeartBeatInterval()不会触发事件,因为状态未更改?
function wlCommonInit(){        
    WL.Client.connect({
      onSuccess: onConnectSuccess,
      onFailure: onConnectFailure
    }); 

    function onConnectSuccess() {
        WL.Logger.debug("Inside the connect-onSuccess");
    }

    function onConnectFailure() {
        WL.Logger.debug("Inside the connect-onFailure");
    }

    WL.Logger.debug("I am inside the WL Common Init");  

    document.addEventListener(WL.Events.WORKLIGHT_IS_CONNECTED, connectDetected, false); 
    document.addEventListener(WL.Events.WORKLIGHT_IS_DISCONNECTED, disconnectDetected , false);
}

 function connectionFailure(){
    alert("Could not connect to the MobileFirst Server.");
    var output = new Date() + "<hr />Working offline";
    $('#info').html(output); 
 }

 function disconnectDetected(){
    var output = new Date() + "<hr />disconnectDetected";
    $('#info').html(output);
 }

 function connectDetected(){
     WL.Logger.debug("connectDetected called");

     var output = new Date() + "<hr />connectDetected";
     $('#info').html(output);
 }

 function setHeartBeatInterval(interval){
    var output = new Date() + "<hr />heartbeat interval is set to: " + interval;
    $('#info').html(output);
    WL.Client.setHeartBeatInterval(interval);
 }