Showing posts with label Session Timeout. Show all posts
Showing posts with label Session Timeout. Show all posts

Sunday, April 1, 2012

Implementing a Client Session Timeout for intensive data access

Often there is a scenario where the user displays a live page that polls the data from server every few seconds to update some contents on page. In case, the user leaves for hours without shutting down the browser. As a result, the page keeps on sending requests, generating a significant—and useless—workload for the server.
On the server, there's session timeout, but in AJAX there's also the client session that matters. To detect the end of a client session, you need to check whether there was user activity such as clicking and tapping for a given amount of time.To detect the end of a session based on a timer, set up a client timer that expires after a specified number of seconds, stops the ongoing task, and pops up an alert box. If the user responds to the prompt, processing resumes as usual. This example update the datetime every 3 seconds and then show confirm dialog box every 10 seconds to ask the user.

Client Session Timeout