Environment:
1. Windows 7 and
2. IBM MobileFirst Platform Studio 7.0
Sample Working offline application of IBM MobileFirst Platform 7.0 from Getting Started Modules imported and tested with the following procedures.
1. Set heartbeat to 5 seconds
2. Background application behavior can be seen using web debuggers
3. Shut down MobileFirst Server
4. In a few seconds heartbeat should fail, and disconnectDetected function should be invoked
5. Start up MobileFirst Server
6. In a few seconds heartbeat should succeed, and connectDetected function should be invoked
But the disconnectDetected and connectDetected functions were not triggered when the server stopped and started respectively.
function disconnectDetected(){
var output = new Date() + "<hr />disconnectDetected";
$('#info').html(output);
}
function connectDetected(){
var output = new Date() + "<hr />connectDetected";
$('#info').html(output);
}
Log's are given below.
http://localhost:10080/WorkingOffline/apps/services/preview/WorkingOffline/common/0/default/js/test.js Failed to load resource: the server responded with a status of 404 (Not Found)
wljq.js:8654 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
worklight.js:5127 wlclient init started
worklight.js:5127 before: initOptions.onSuccess
worklight.js:5127 after: initOptions.onSuccess
worklight.js:5127 wlclient init success
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 401 (Unauthorized)
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3794 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.handleResendOrSendPostAnswersworklight.js:3783 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.removeExpectedAnswerworklight.js:9432 challengeHandler.submitChallengeAnswerworklight.js:10193 wl_antiXSRFChallengeHandler.handleChallengeworklight.js:9328 AbstractChallengeHandler.startChallengeHandlingworklight.js:9251 executeChallengeworklight.js:9153 checkResponseForChallengesworklight.js:3598 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onWlFailureworklight.js:956 (anonymous function)worklight.js:1178 window.WLJSX.Ajax.Request.WLJSX.Class.create.respondToReadyStateworklight.js:1111 window.WLJSX.Ajax.Request.WLJSX.Class.create.onStateChangeworklight.js:956 (anonymous function)
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application is now online.
worklight.js:5127 response [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] success:
worklight.js:5127 Heartbeat sent successfully
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:5127 Application is now online.
worklight.js:5127 response [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] success:
worklight.js:5127 Heartbeat sent successfully
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 404 (Not Found)
worklight.js:5127 Application is now online.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] failure. state: 404, response: The server was unable to process the request from the application. Please try again later.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 503 (Service Unavailable)
worklight.js:5127 Application is now online.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] failure. state: 503, response: The server was unable to process the request from the application. Please try again later.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 503 (Service Unavailable)
worklight.js:5127 Application is now online.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] failure. state: 503, response: The server was unable to process the request from the application. Please try again later.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 503 (Service Unavailable)
worklight.js:5127 Application is now online.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] failure. state: 503, response: The server was unable to process the request from the application. Please try again later.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 401 (Unauthorized)
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3794 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.handleResendOrSendPostAnswersworklight.js:3783 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.removeExpectedAnswerworklight.js:9432 challengeHandler.submitChallengeAnswerworklight.js:10193 wl_antiXSRFChallengeHandler.handleChallengeworklight.js:9328 AbstractChallengeHandler.startChallengeHandlingworklight.js:9251 executeChallengeworklight.js:9153 checkResponseForChallengesworklight.js:3598 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onWlFailureworklight.js:956 (anonymous function)worklight.js:1178 window.WLJSX.Ajax.Request.WLJSX.Class.create.respondToReadyStateworklight.js:1111 window.WLJSX.Ajax.Request.WLJSX.Class.create.onStateChangeworklight.js:956 (anonymous function)
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application is now online.
worklight.js:5127 response [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] success:
worklight.js:5127 Heartbeat sent successfully
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: {"applicationDetails":{"platformVersion":"7.0.0.0","nativeVersion":""}}worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:5127 Application is now online.
worklight.js:5127 response [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] success:
worklight.js:5127 Heartbeat sent successfully
But, getting started from the IBM MobileFirst Platform 6.3 Sample Working Offline application works perfectly in IBM MobileFirst Studio 6.3