diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-02-26 19:34:46 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-02-26 19:34:46 +0100 |
commit | 4e553480540a36cf14a107e65e2bc4d4d9f1a2e6 (patch) | |
tree | dbeab923d666cbba1327731339adffb9dd2fe402 | |
parent | b987c76d16a6bdaf931776763dea18915c99e804 (diff) | |
download | nextcloud-server-4e553480540a36cf14a107e65e2bc4d4d9f1a2e6.tar.gz nextcloud-server-4e553480540a36cf14a107e65e2bc4d4d9f1a2e6.zip |
implemented a heartbeat request which is calls the server every 15 minutes to prevent a session timeout
-rw-r--r-- | core/js/js.js | 15 | ||||
-rw-r--r-- | core/routes.php | 5 |
2 files changed, 20 insertions, 0 deletions
diff --git a/core/js/js.js b/core/js/js.js index e373fca8865..597ca2af9af 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -584,6 +584,7 @@ function fillWindow(selector) { } $(document).ready(function(){ + sessionHeartBeat(); if(!SVGSupport()){ //replace all svg images with png images for browser that dont support svg replaceSVG(); @@ -815,3 +816,17 @@ OC.set=function(name, value) { } context[tail]=value; }; + + +/** + * Calls the server periodically every 15 mins to ensure that session doesnt + * time out + */ +function sessionHeartBeat(){ + OC.Router.registerLoadedCallback(function(){ + setInterval(function(){ + var url = OC.Router.generate('heartbeat'); + $.post(url); + }, 15000); + }); +}
\ No newline at end of file diff --git a/core/routes.php b/core/routes.php index 2527816b662..be19b66bf72 100644 --- a/core/routes.php +++ b/core/routes.php @@ -69,3 +69,8 @@ $this->create('app_script', '/apps/{app}/{file}') ->defaults(array('file' => 'index.php')) ->requirements(array('file' => '.*.php')) ->action('OC', 'loadAppScriptFile'); + +// used for heartbeat +$this->create('heartbeat', '/heartbeat')->action(function(){ + // do nothing +});
\ No newline at end of file |