Don't recursively reconnect if the server sends a normal close

This commit is contained in:
Shaka Chen 2022-08-03 20:36:34 +08:00
parent a05ff40e97
commit 7713d7f02f

View file

@ -64,6 +64,10 @@ function Setup_ws() {
}
ws.onclose = function (event) {
if (event.code && event.code === 1000) {
console.log("WebSocket connection got normal close from server. Don't reconnect.");
Shutdown_ws(event);
} else {
console.log ('onclose: reconnect');
ws = null;
ws = new WebSocket (adr + '?r=' + clog['connection_id']);
@ -77,6 +81,7 @@ function Setup_ws() {
}
}
}
}
function Open_ws() {
if (location.protocol == 'https:') {