diff options
author | Cheng-Han, Wu | 2016-06-01 14:18:54 +0800 |
---|---|---|
committer | Cheng-Han, Wu | 2016-06-01 14:18:54 +0800 |
commit | 16d5e3ea8020c839dd6e2dd192e8ccba71f39eed (patch) | |
tree | e162ad888179ad9468979fbeb6017254abedf783 /public | |
parent | 27e17d777281cda47b125de5d87714c532700c3d (diff) |
Add maintenance mode and update to gracefully exit process on signal
Diffstat (limited to '')
-rw-r--r-- | public/js/index.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/public/js/index.js b/public/js/index.js index 1d6db920..4ac1b508 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1825,6 +1825,11 @@ socket.on('error', function (data) { if (data.message && data.message.indexOf('AUTH failed') === 0) location.href = "./403"; }); +var retryOnDisconnect = false; +socket.on('maintenance', function (data) { + if (data == version) + retryOnDisconnect = true; +}); socket.on('disconnect', function (data) { showStatus(statusType.offline); if (loaded) { @@ -1833,12 +1838,15 @@ socket.on('disconnect', function (data) { } if (!editor.getOption('readOnly')) editor.setOption('readOnly', true); + if (retryOnDisconnect) + socket.connect(); }); socket.on('reconnect', function (data) { //sync back any change in offline emitUserStatus(true); cursorActivity(); socket.emit('online users'); + retryOnDisconnect = false; }); socket.on('connect', function (data) { personalInfo['id'] = socket.id; |