Get WS to backoff slightly, if the connection keeps dropping.
This commit is contained in:
parent
f2572fc3bd
commit
526ba8dc0e
|
@ -8,6 +8,7 @@ var conn = false;
|
||||||
var selectedTopics = [];
|
var selectedTopics = [];
|
||||||
var attachItemCallback = function(){}
|
var attachItemCallback = function(){}
|
||||||
var baseTitle = document.title;
|
var baseTitle = document.title;
|
||||||
|
var wsBackoff = false;
|
||||||
|
|
||||||
// Topic move
|
// Topic move
|
||||||
var forumToMoveTo = 0;
|
var forumToMoveTo = 0;
|
||||||
|
@ -212,13 +213,16 @@ function runWebSockets() {
|
||||||
conn.onclose = () => {
|
conn.onclose = () => {
|
||||||
conn = false;
|
conn = false;
|
||||||
console.log("The WebSockets connection was closed");
|
console.log("The WebSockets connection was closed");
|
||||||
|
let backoff = 1000;
|
||||||
|
if(wsBackoff) backoff = 8000;
|
||||||
|
wsBackoff = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
var alertMenuList = document.getElementsByClassName("menu_alerts");
|
var alertMenuList = document.getElementsByClassName("menu_alerts");
|
||||||
for(var i = 0; i < alertMenuList.length; i++) {
|
for(var i = 0; i < alertMenuList.length; i++) {
|
||||||
loadAlerts(alertMenuList[i]);
|
loadAlerts(alertMenuList[i]);
|
||||||
}
|
}
|
||||||
runWebSockets();
|
runWebSockets();
|
||||||
}, 60 * 1000);
|
}, 60 * backoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
conn.onmessage = (event) => {
|
conn.onmessage = (event) => {
|
||||||
|
|
Loading…
Reference in New Issue