Browse Source

implemented a heartbeat request which is calls the server every 15 minutes to prevent a session timeout

tags/v5.0.0RC1
Bernhard Posselt 11 years ago
parent
commit
4e55348054
2 changed files with 20 additions and 0 deletions
  1. 15
    0
      core/js/js.js
  2. 5
    0
      core/routes.php

+ 15
- 0
core/js/js.js View File

@@ -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);
});
}

+ 5
- 0
core/routes.php View File

@@ -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
});

Loading…
Cancel
Save