try to fix race-condition in reconnecting a "lost" websocket connection

This commit is contained in:
Ralf Becker 2020-10-27 14:15:58 +01:00
parent ee66df7a8e
commit ed9062d839

View File

@ -118,8 +118,12 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
{ {
console.log("Server did not respond to ping in "+max_ping_response_time+" seconds --> try reconnecting"); console.log("Server did not respond to ping in "+max_ping_response_time+" seconds --> try reconnecting");
check_timer = null; check_timer = null;
this.websocket.close(); // closing it now, before reopening it, to not end up with multiple connections this.websocket.onclose = function()
{
this.websocket = null;
this.openWebSocket(url, tokens, account_id, error, reconnect_time); this.openWebSocket(url, tokens, account_id, error, reconnect_time);
}
this.websocket.close(); // closing it now, before reopening it, to not end up with multiple connections
}.bind(this), max_ping_response_time); }.bind(this), max_ping_response_time);
}.bind(this); }.bind(this);