Skip to content

Commit

Permalink
Merge pull request #353 from ic0xgkk/master
Browse files Browse the repository at this point in the history
Added websocket heartbeat
  • Loading branch information
skavanagh committed Aug 2, 2020
2 parents 0c9b403 + d7b3709 commit faf2273
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/main/webapp/admin/secure_shell.html
Expand Up @@ -263,7 +263,20 @@
ws_uri += "//" + loc.host + loc.pathname + '/../terms.ws?t=' + new Date().getTime();

var connection = new WebSocket(ws_uri);


function heartbeat() {
if (!connection) return;
if (connection.readyState !== 1) return;
connection.send("heartbeat");

// Set heartbeat interval 10,000 ms
setTimeout(heartbeat, 10000);
};

// Register websocket heartbeat
connection.onopen = function (e) {
heartbeat();
};

// Log errors
connection.onerror = function (error) {
Expand Down

0 comments on commit faf2273

Please sign in to comment.