Note that there are some explanatory texts on larger screens.

plurals
  1. POWL.Client.connect onSuccess callback does not get called
    text
    copied!<p>Given the following code, the onSuccess is not being called back on a successful connect. I've listed the code and log output for the sequence of events. Is the code set up wrong? connectOnStartup is set to false in the initOptions. This code is also in the Shell project with the logcat coming from the Inner project using the Shell:</p> <pre><code>function onConnectSuccess(){ console.log ("CSXMobile:onConnectSuccess"); WL.Logger.debug("CSXMobile:onConnectSuccess"); } function onConnectFailure(){ WL.Logger.debug("CSXMobile:onConnectFailure"); } function disconnectDetected(){ WL.Logger.debug("CSXMobile:disconnectDetected"); } function connectDetected(){ WL.Logger.debug("CSXMobile:connectDetected"); } function wlCommonInit(){ WL.Logger.debug("CSXMobile:wlCommonInit"); document.addEventListener(WL.Events.WORKLIGHT_IS_CONNECTED, connectDetected, false); document.addEventListener(WL.Events.WORKLIGHT_IS_DISCONNECTED, disconnectDetected , false); WL.Client.connect({ onSuccess: onConnectSuccess, onFailure: onConnectFailure }); } </code></pre> <p>As seen in the logs here wlCommonInit is being called and logged, but the log statements in the onConnectSuccess is never written...</p> <pre><code>11-21 13:49:01.460: D/CSXMobileShellTest(6341): wlclient init started 11-21 13:49:01.460: D/CSXMobileShellTest(6341): Read cookies: null 11-21 13:49:01.460: D/CSXMobileShellTest(6341): CookieMgr read cookies: {} 11-21 13:49:01.507: D/dalvikvm(6341): GC_CONCURRENT freed 311K, 4% free 11407K/11783K, paused 2ms+16ms, total 34ms 11-21 13:49:01.507: D/CordovaNetworkManager(6341): Connection Type: wifi 11-21 13:49:01.507: D/DroidGap(6341): onMessage(networkconnection,wifi) 11-21 13:49:01.507: D/DroidGap(6341): onMessage(spinner,stop) 11-21 13:49:01.507: D/CordovaLog(6341): CSXMobile:csxmobileDeviceReady 11-21 13:49:01.507: I/Web Console(6341): CSXMobile:csxmobileDeviceReady at file:///data/data/com.csx.CSXMobileShellTest/files/www/default/js/CSXMobile.js:172 11-21 13:49:01.538: D/CSXMobileShellTest(6341): CSXMobile:deviceOnline 11-21 13:49:01.546: D/CSXMobileShellTest(6341): before: app init onSuccess 11-21 13:49:01.546: D/CSXMobileShellTest(6341): CSXMobile:wlCommonInit 11-21 13:49:01.561: D/CSXMobileShellTest(6341): Request [https://myworklightserver/query] 11-21 13:49:01.585: D/CSXMobileShellTest(6341): after: app init onSuccess 11-21 13:49:01.585: D/CSXMobileShellTest(6341): added onPause event handler 11-21 13:49:01.585: D/CSXMobileShellTest(6341): wlclient init success 11-21 13:49:01.858: D/CSXMobileShellTest(6341): isCustomResponse 11-21 13:49:01.858: D/CSXMobileShellTest(6341): isCustomResponse true 11-21 13:49:01.858: D/CSXMobileShellTest(6341): handleChallenge 11-21 14:14:57.796: D/DroidGap(6656): onMessage(spinner,stop) 11-21 14:15:08.975: D/CSXMobileShellTest(6656): Request [login] 11-21 14:15:09.132: D/CSXMobileShellTest(6656): Status =401 11-21 14:15:09.132: D/CSXMobileShellTest(6656): isCustomResponse 11-21 14:15:09.139: D/CSXMobileShellTest(6656): isCustomResponse false 11-21 14:15:09.147: D/CSXMobileShellTest(6656): Request [https://myworklightserver/query] 11-21 14:15:09.163: D/CSXMobileShellTest(6656): hideLogin 11-21 14:15:09.413: D/Cordova(6656): onPageFinished(file:///data/data/com.csx.CSXMobileShellTest/files/www/default/CSXMobileShellTest.html#testMainPage) 11-21 14:15:09.413: D/Cordova(6656): Trying to fire onNativeReady 11-21 14:15:09.413: D/DroidGap(6656): onMessage(onNativeReady,null) 11-21 14:15:09.413: D/DroidGap(6656): onMessage(onPageFinished,file:///data/data/com.csx.CSXMobileShellTest/files/www/default/CSXMobileShellTest.html#testMainPage) 11-21 14:15:09.475: D/CSXMobileShellTest(6656): Request [https://myworklightserver/query] 11-21 14:15:09.522: D/CSXMobileShellTest(6656): Request [https://myworklightserver/query] 11-21 14:15:09.616: D/CSXMobileShellTest(6656): isCustomResponse 11-21 14:15:09.616: D/CSXMobileShellTest(6656): isCustomResponse false 11-21 14:15:09.616: D/CSXMobileShellTest(6656): CSXMobile:connectDetected 11-21 14:15:09.647: D/CSXMobileShellTest(6656): response [https://myworklightserver/query] success: /*-secure- </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload