Detect phantom tabs using PING in the worker

pull/1/head
yflory 6 years ago
parent ab832643f7
commit 52dbc296ee

@ -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 = {

@ -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);
*/
};
/**

@ -874,6 +874,10 @@ define([
Cryptpad.cursor.execCommand(data, cb);
});
Cryptpad.onTimeoutEvent.reg(function () {
sframeChan.event('EV_WORKER_TIMEOUT');
});
if (cfg.messaging) {
Notifier.getPermission();

@ -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);
});

Loading…
Cancel
Save