aboutsummaryrefslogtreecommitdiffstats
path: root/templates/index.html
diff options
context:
space:
mode:
authorGravatar Christopher Baklid <[email protected]>2018-05-26 12:54:49 +0200
committerGravatar Christopher Baklid <[email protected]>2018-05-26 12:54:49 +0200
commitea2141dc6fd7284e6f9fa04ee638460286e3b09c (patch)
tree218d332be80bd2f4e177b0d9e4725dd27dec2034 /templates/index.html
parentlint (diff)
simplify threads and use local thread variables to manage user websocket connections
Diffstat (limited to 'templates/index.html')
-rw-r--r--templates/index.html6
1 files changed, 4 insertions, 2 deletions
diff --git a/templates/index.html b/templates/index.html
index ef53d74..9fd6350 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -91,8 +91,10 @@ function generate_id(){
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
}
-
-
+window.onbeforeunload = function() {
+ sendMessage("disconnect")
+ websocket.close()
+};
window.addEventListener("load", init, false);