From e0debfed54a88174c1ffaddb56ed519fa0a4b78d Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 4 Dec 2017 19:44:30 +0100 Subject: [PATCH] Close sockets 'beforeunload' --- view/main.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/view/main.js b/view/main.js index 2c5fa9e..c57a163 100755 --- a/view/main.js +++ b/view/main.js @@ -77,3 +77,10 @@ window.wsc_chat = window.wsc.channel('chat').listen(function(msg, err){ }).send({name: window._SERVER.session.name}); + +/* (4) Clean sockets before page quit +---------------------------------------------------------*/ +window.onbeforeunload = function() { + window.wdc_chat.ws.close(); + window.wdc_connect.ws.close(); +}; \ No newline at end of file