Reconnect to the websocket immediately in case of normal closure

This commit is contained in:
Fabio Manganiello 2018-04-09 23:21:19 +02:00
parent d380e0f398
commit ce5db9a9c6
1 changed files with 2 additions and 1 deletions

View File

@ -33,7 +33,8 @@ $(document).ready(function() {
console.log('Websocket closed, code: ' + event.code);
websocketReconnectInterval = setInterval(function() {
initWebsocket();
}, 5000);
}, event.code == 1000 ? 10 : 5000); // Reconnect immediately in case of normal websocket closure
// otherwise wait 5 seconds
};
};