mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 14:00:21 +00:00
Force reconnect on server shutdown
This commit is contained in:
parent
532f55cb86
commit
935c5b309a
1 changed files with 7 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
const $ = require("jquery");
|
||||
const io = require("socket.io-client");
|
||||
const utils = require("./utils");
|
||||
const path = window.location.pathname + "socket.io/";
|
||||
const status = $("#loading-page-message, #connection-error");
|
||||
|
||||
|
@ -43,6 +44,12 @@ function handleDisconnect(data) {
|
|||
status.text(`Waiting to reconnect… (${message})`).addClass("shown");
|
||||
$(".show-more-button, #input").prop("disabled", true);
|
||||
$("#submit").hide();
|
||||
|
||||
// If the server shuts down, socket.io skips reconnection
|
||||
// and we have to manually call connect to start the process
|
||||
if (socket.io.skipReconnect) {
|
||||
utils.requestIdleCallback(() => socket.connect(), 2000);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = socket;
|
||||
|
|
Loading…
Reference in a new issue