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