mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-25 21:39:21 +00:00
Reload page only if WebSocket was not gracefully closed
This commit is contained in:
parent
7d9b035e57
commit
4c5a608531
@ -48,11 +48,17 @@ class UserWebSocket {
|
|||||||
static async Closed(e) {
|
static async Closed(e) {
|
||||||
console.error("WS closed", e)
|
console.error("WS closed", e)
|
||||||
|
|
||||||
|
// Check if the server was gracefully stopped
|
||||||
|
if(!this.hasOwnProperty("ws"))
|
||||||
|
return;
|
||||||
|
|
||||||
const num_seconds = ComunicWeb.__config.productionMode ? 5 : 0.5;
|
const num_seconds = ComunicWeb.__config.productionMode ? 5 : 0.5;
|
||||||
|
|
||||||
notify("Disconnected from the server, page will be reloaded in "+num_seconds+" seconds !", "danger");
|
notify("Disconnected from the server, page will be reloaded in "+num_seconds+" seconds !", "danger");
|
||||||
|
|
||||||
setTimeout(() => ComunicWeb.common.system.restart(), num_seconds*1000);
|
setTimeout(() => {
|
||||||
|
ComunicWeb.common.system.restart();
|
||||||
|
}, num_seconds*1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user