serverSessionTimeout not working IBM Worklight

て烟熏妆下的殇ゞ 提交于 2019-12-11 23:16:06

问题


I have added the serverSessionTimeout=3 in the worklight properties file, I have edited this in the WAS server and restarted the application, but when i test the app and keep it idle for 3 mins, i cant see the server session time out automatically, is there anything we need to call on the mobile client to check if the server session time out is done or not. please help

Thanks djrecker


回答1:


You could try disabling the heartbeat using

WL.Client.setHeartBeatInterval(-1)

Maybe during the initialization of your app

Documentation at:

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

With that the session timeout may work with the app in foreground too.




回答2:


Please look at the following documentation to get a better understanding of how the serverSessionTimeout and heartbeat property effect eachother as well as other tuning mechanisms:

http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/index.jsp?topic=%2Fcom.ibm.worklight.help.doc%2Fadmin%2Fc_optimizing_and_tuning_of_ibm_wl_server.html

Specifically the "Worklight Server internal configuration" section:

"Consider the following factors:

  • A session is an object that is stored in server memory for each connecting device. Among other things, it stores authentication information. The number of active sessions is the difference between the number of opened sessions and the number of sessions that are timing out because of inactivity. The serverSessionTimeout property configures the session timeout and affects the server memory consumption. The default session timeout is 10 minutes.
  • The mobile client "heartbeat" property causes the mobile client to ping the server while the app is in the foreground. This feature prevents the server session from timing out. When a mobile app runs in the background, it no longer interacts with the server or sends a “heartbeat”. The server session drops after the specified server session timeout period.
  • For example, suppose every minute 1,000 users start a session against the server. Even if they exit the application after 3 minutes, their sessions remain active on the server for 10 minutes, leaving 10 x 1,000 = 10,000 active sessions. "



回答3:


If the app is in the foreground, a heartbeat message will be sent to the server and the session will not time out. So the app should be placed in the background for the timeout to occur. If that does not help, please try the test for a period of 10 minutes, as this is the default session timeout value.

Normally the value of the serverSessionTimeout is greater than the heartbeat interval so that the session is kept alive when idle and as long as the application is in the foreground. So as long as the app is in the foregraound, by design it will never invalidate the session. But on the other hand, if it is backgrounded then there are no heartbeats and then past the default 10 min in the background state, the session is invalidated. This is the intention here.



来源:https://stackoverflow.com/questions/22019110/serversessiontimeout-not-working-ibm-worklight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!