2

I have a scenario where I'd like to poll Salesforce for data via Visualforce Remote Action, but according to this answer, Remote Actions count as activity and cause the session timeout countdown to reset.

I still want the security timeout to kick the user out after the defined interval. Is there any way to exempt my Remote Action from resetting the timeout clock? Is there another way to poll data that doesn't keep the user logged in indefinitely? Because I'll be polling at relatively short intervals, any method that burns through API limits will not fly.

3

Any activity on a session ID resets the timer. This includes polling, streaming, or generally doing anything at all that interacts with the user. Worse, implementing your own time out method in your page (e.g. calling /secur/logout.jsp if no action is detected), may result in the user's session expiring in a different tab, etc, which many users tend to do these days. Your best bet is simply to allow the session to be managed by Salesforce, as it is today. You might choose to detect if your page has had no activity in the past few minutes and shut down the polling loop; this will eventually lead to session expiration if they remain inactive for the configured session timeout period. You can resume polling once you detect some activity on your page, such as them clicking on a button, a mouse move event, or whatever else you deem to be a qualifying activity to resume polling.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.