diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 11b435b58..42fe7a55a 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -1058,14 +1058,12 @@ define([ }; var timeout = false; + common.onTimeoutEvent = Util.mkEvent(); var onTimeout = function () { - return; - /* timeout = true; common.onNetworkDisconnect.fire(); - // FIXME: no UI in outer... - window.alert("Timeout error, please reload this tab"); - */ + common.padRpc.onDisconnectEvent.fire(); + common.onTimeoutEvent.fire(); }; var queries = { diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 06ab0f089..0ab5ff0eb 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -1602,12 +1602,11 @@ define([ broadcast([], 'NETWORK_RECONNECT', {myId: info.myId}); }); - /* // Ping clients regularly to make sure one tab was not closed without sending a removeClient() // command. This allow us to avoid phantom viewers in pads. var PING_INTERVAL = 30000; - var MAX_PING = 1000; - var MAX_FAILED_PING = 5; + var MAX_PING = 5000; + var MAX_FAILED_PING = 2; setInterval(function () { var clients = []; @@ -1635,7 +1634,6 @@ define([ ping(); }); }, PING_INTERVAL); - */ }; /** diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index b74a743d8..f46662c40 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -874,6 +874,10 @@ define([ Cryptpad.cursor.execCommand(data, cb); }); + Cryptpad.onTimeoutEvent.reg(function () { + sframeChan.event('EV_WORKER_TIMEOUT'); + }); + if (cfg.messaging) { Notifier.getPermission(); diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 17783f460..f33ec1386 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -613,6 +613,10 @@ define([ }); }); + ctx.sframeChan.on('EV_WORKER_TIMEOUT', function () { + UI.errorLoadingScreen(Messages.timeoutError) // XXX + }); + ctx.sframeChan.on('EV_CHROME_68', function () { UI.alert(Messages.chrome68); });