Offline drive (or team) detection

This commit is contained in:
yflory
2019-11-14 11:44:23 +01:00
parent 63ea882545
commit c9c19b8395
6 changed files with 44 additions and 29 deletions

View File

@@ -57,6 +57,14 @@ define([
return false;
}
});
proxy.on('disconnect', function () {
team.offline = true;
team.sendEvent('NETWORK_DISCONNECT');
});
proxy.on('reconnect', function () {
team.offline = false;
team.sendEvent('NETWORK_RECONNECT');
});
}
proxy.on('change', [], function (o, n, p) {
if (fId) {
@@ -101,12 +109,6 @@ define([
path: p
});
});
proxy.on('disconnect', function () {
team.offline = true;
});
proxy.on('reconnect', function (/* info */) {
team.offline = false;
});
};
var closeTeam = function (ctx, teamId) {
@@ -1363,6 +1365,10 @@ define([
removeClient(ctx, clientId);
};
team.execCommand = function (clientId, obj, cb) {
if (ctx.store.offline) {
return void cb({ error: 'OFFLINE' });
}
var cmd = obj.cmd;
var data = obj.data;
if (cmd === 'SUBSCRIBE') {