mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
better handle slow connections on reconnect
This commit is contained in:
parent
e19ac8bc42
commit
ed9e5519f6
1 changed files with 2 additions and 5 deletions
7
static-files/js/boot.js
vendored
7
static-files/js/boot.js
vendored
|
|
@ -33,15 +33,12 @@ function Shutdown_ws(event) {
|
||||||
ws = null;
|
ws = null;
|
||||||
}
|
}
|
||||||
clearInterval (pingerid);
|
clearInterval (pingerid);
|
||||||
clearInterval (retryid);
|
|
||||||
if (clog['html_on_close'] != '') {
|
if (clog['html_on_close'] != '') {
|
||||||
$(document.body).html(clog['html_on_close']);
|
$(document.body).html(clog['html_on_close']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Setup_ws() {
|
function Setup_ws() {
|
||||||
clearInterval (retryid);
|
|
||||||
retryid = 0;
|
|
||||||
ws.onmessage = function (event) {
|
ws.onmessage = function (event) {
|
||||||
try {
|
try {
|
||||||
if (clog_debug == true) {
|
if (clog_debug == true) {
|
||||||
|
|
@ -55,6 +52,7 @@ function Setup_ws() {
|
||||||
|
|
||||||
var rc = function (event) {
|
var rc = function (event) {
|
||||||
console.log (event);
|
console.log (event);
|
||||||
|
clearInterval (retryid);
|
||||||
ws = null;
|
ws = null;
|
||||||
ws = new WebSocket (adr + '?r=' + clog['connection_id']);
|
ws = new WebSocket (adr + '?r=' + clog['connection_id']);
|
||||||
ws.onopen = function (event) {
|
ws.onopen = function (event) {
|
||||||
|
|
@ -64,8 +62,7 @@ function Setup_ws() {
|
||||||
ws.onclose = function (event) {
|
ws.onclose = function (event) {
|
||||||
console.log ('reconnect failure');
|
console.log ('reconnect failure');
|
||||||
console.log (Date.now());
|
console.log (Date.now());
|
||||||
if (retryid == 0)
|
retryid = setInterval(function () {rc("Failed reconnect - trying again")}, 500);
|
||||||
retryid = setInterval(function () {rc("Failed reconnect - trying again")}, 500);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue