GUAC-867: Add periodic keep-alive ping to ensure the session does not perish while a connection is active.

This commit is contained in:
Michael Jumper committed 2014-10-13 03:25:31 -07:00
1 parent 115f647f7a
commit 04ba001f15
4 files changed
+111 -7

No files matched your search

@@ -1438,3 +1438,26 @@ GuacamoleService.Clipboard = {
}
};
/**
* Collection of service functions which deal with the session keep-alive. Each
* function makes an explicit HTTP query to the server. In the case of the
* keep-alive ping, no response is expected, and any received response is
* ignored.
*/
GuacamoleService.KeepAlive = {
"ping" : function(parameters) {
// Construct request URL
var ping_url = "keep-alive";
if (parameters) ping_url += "?" + parameters;
// Send keep-alive "ping"
var xhr = new XMLHttpRequest();
xhr.open("GET", ping_url, true);
xhr.send(null);
}
};