Added "heartbeat" for update throttling.

This commit is contained in:
Michael Jumper
2010-09-08 01:43:34 -07:00
parent af0b4d933d
commit 23ddb964b9
7 changed files with 96 additions and 7 deletions

View File

@@ -540,7 +540,27 @@ function VNCClient(display) {
handler(parameters);
}
function sendReady() {
// Start heartbeat signal
var heartbeat = new XMLHttpRequest();
heartbeat.open("GET", "ready");
heartbeat.onreadystatechange = function() {
if (heartbeat != null && heartbeat.readyState >= 2) {
heartbeat = null;
setTimeout(sendReady, 50);
}
};
heartbeat.send();
}
this.connect = function() {
@@ -555,6 +575,7 @@ function VNCClient(display) {
var message = new GuacamoleMessage(connect_xmlhttprequest.responseXML);
if (!message.hasErrors()) {
setState(STATE_WAITING);
sendReady();
handleResponse(makeRequest()); // Start stream if connection successful
}
else