From 28c9ccf5bed3756c63abf4d2138ff7d0fe04ad8b Mon Sep 17 00:00:00 2001 From: H4CK3R-01 Date: Thu, 10 Jun 2021 16:27:32 +0200 Subject: [PATCH] Disconnect only if user confirms --- public/index.html | 2 +- public/js/chat.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index 8583fe4..f8c1518 100644 --- a/public/index.html +++ b/public/index.html @@ -53,7 +53,7 @@ + src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.2/socket.io.js"> diff --git a/public/js/chat.js b/public/js/chat.js index 1558691..424f466 100644 --- a/public/js/chat.js +++ b/public/js/chat.js @@ -2,7 +2,9 @@ let socket; let connected = false; function start_chat() { - socket = io(); + socket = io("/", { + closeOnBeforeunload: false + }); socket.on('login', function () { connected = true;