Worklight 6.1.0.1(企业版)
我在Android 4.4.2上运行了一个Worklight混合应用程序。它使用基于适配器的身份验证进行最终用户登录/注销,用户在成功登录后自动订阅推送通知,并在成功注销时取消订阅。此外,我使用Worklight服务器超时来超时用户,但我没有设置心跳间隔。服务器超时设置为3分钟,用于测试目的。
所有内容(包括推送通知)都很有用,直到我按照以下步骤操作:
当第二次尝试订阅时,这些步骤在Logcat中产生以下错误:
04-16 17:52:43.200: E/NONE(1493): [http://ipaddress:10080/Mobile/apps/services/api/Student/android/notifications] failure. state: 500, response: Notification token unknown, subscribe to Push.StudentPushAlerts failed.
Worklight Development Server控制台产生此错误:
[ERROR ] FWLSE0020E: Ajax request exception: Notification token unknown, subscribe to Push.StudentPushAlerts failed. [project Mobile]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project Mobile]Notification token unknown, subscribe to Push.StudentPushAlerts failed., User Identity {wl_authenticityRealm=null, AdapterAuthRealm=(name:12345678, loginModule:NonValidatingLoginModule), wl_remoteDisableRealm=(name:null, loginModule:NullLoginModule), wl_antiXSRFRealm=(name:cq6d0it2a32h7r57a7ineiaku8, loginModule:WLAntiXSRFLoginModule), wl_deviceAutoProvisioningRealm=null, wl_deviceNoProvisioningRealm=(name:d26bdbbb-ffeb-3070-bd5c-cfd407fb89cb, loginModule:WLDeviceNoProvisioningLoginModule), myserver=(name:1122a30c-992d-464d-a46a-880d20d03eee, loginModule:WeakDummy), wl_anonymousUserRealm=(name:1122a30c-992d-464d-a46a-880d20d03eee, loginModule:WeakDummy)}. [project Mobile]
com.worklight.common.log.filters.ErrorFilter
经过多次试验和错误后,如果我在登录之间等待的持续时间略大于服务器端超时值,则无法在第二次订阅时传递错误。在这种情况下,服务器超时为3分钟,我等待四分钟以始终产生错误。
我试图在IBM PushNotifications项目示例中重现这种行为,通过进行一些小的调整来模仿我的应用程序的流程,我不得不添加超时和心跳以使其工作。我确实重现了错误,但场景只与我的相似,所以我怀疑我没有看到全貌。但是,错误是一样的。
我正在使用的IBM示例可以在此处找到:modified IBM sample(从提供的示例中删除了GCM id / key)
我可以使用以下步骤在我修改的IBM示例中重现错误:
与我的项目类似,这些步骤在第二次尝试订阅时会在Logcat中产生以下错误:
04-16 15:54:06.952: E/NONE(7133): [http://ipaddress:10080/PushNotifications/apps/services/api/PushNotifications/android/notifications] failure. state: 500, response: Notification token unknown, subscribe to PushAdapter.PushEventSource failed.
Worklight Development Server控制台产生此错误:
[ERROR ] FWLSE0020E: Ajax request exception: Notification token unknown, subscribe to PushAdapter.PushEventSource failed. [project PushNotifications]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project PushNotifications]Notification token unknown, subscribe to PushAdapter.PushEventSource failed., User Identity {wl_authenticityRealm=null, wl_remoteDisableRealm=(name:null, loginModule:NullLoginModule), wl_antiXSRFRealm=(name:u7kpkmov3r8259mvu8t0s0h6v6, loginModule:WLAntiXSRFLoginModule), PushAppRealm=(name:james, loginModule:PushAppLoginModule), wl_deviceAutoProvisioningRealm=null, wl_deviceNoProvisioningRealm=(name:0bd1dcc9-2d93-35a4-a216-1ff3b7ba908d, loginModule:WLDeviceNoProvisioningLoginModule), myserver=(name:james, loginModule:PushAppLoginModule), wl_anonymousUserRealm=null}. [project PushNotifications]
com.worklight.common.log.filters.ErrorFilter
如果我不在登录之间等待,则订阅每次都会成功,即使是切换用户也是如此。我的应用程序的authenticationConfig.xml是:
<securityTests>
<mobileSecurityTest name="Authentication-securityTest">
<testDeviceId provisioningType="none"/>
<testUser realm="AdapterAuthRealm"/>
</mobileSecurityTest>
</securityTests>
<realms>
<realm loginModule="NonValidatingLoginModule" name="AdapterAuthRealm">
<className>com.worklight.integration.auth.AdapterAuthenticator</className>
<parameter name="login-function" value="Authentication.onAuthRequired"/>
<parameter name="logout-function" value="Authentication.onLogout"/>
</realm>
</realms>
<loginModules>
<loginModule name="NonValidatingLoginModule">
<className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
</loginModule>
</loginModules>