diff options
author | Luiza Pagliari <lpagliari@gmail.com> | 2017-04-04 11:09:24 -0300 |
---|---|---|
committer | Luiza Pagliari <lpagliari@gmail.com> | 2017-04-04 11:09:24 -0300 |
commit | 009cd3124370d44a9c567332bf3be63826fd95b4 (patch) | |
tree | 233f9fe1f26a5188d42461139d862bd7ff30029f /src/node | |
parent | ed029b599ee83edefd37b14dc44275b24316bf91 (diff) | |
download | etherpad-lite-009cd3124370d44a9c567332bf3be63826fd95b4.zip |
[feature] Create option to automatically reconnect after a few seconds
On some erros that display a modal with "Force reconnect" button, allow
Etherpad to automatically reload pad after a few seconds. Amount of
seconds is defined on settings.json.
Still need to create tests for this feature, and implement i18n.
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/handler/PadMessageHandler.js | 9 | ||||
-rw-r--r-- | src/node/utils/Settings.js | 5 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 279a44e1..20b262f4 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -936,7 +936,7 @@ function handleSwitchToPad(client, message) var currentSession = sessioninfos[client.id]; var padId = currentSession.padId; var roomClients = _getRoomClients(padId); - + async.forEach(roomClients, function(client, callback) { var sinfo = sessioninfos[client.id]; if(sinfo && sinfo.author == currentSession.author) { @@ -1115,7 +1115,7 @@ function handleClientReady(client, message) //Check if this author is already on the pad, if yes, kick the other sessions! var roomClients = _getRoomClients(pad.id); - + async.forEach(roomClients, function(client, callback) { var sinfo = sessioninfos[client.id]; if(sinfo && sinfo.author == author) { @@ -1176,6 +1176,7 @@ function handleClientReady(client, message) "accountPrivs": { "maxRevisions": 100 }, + "automaticReconnectionTimeout": settings.automaticReconnectionTimeout, "initialRevisionList": [], "initialOptions": { "guestPolicy": "deny" @@ -1676,13 +1677,13 @@ function composePadChangesets(padId, startNum, endNum, callback) function _getRoomClients(padID) { var roomClients = []; var room = socketio.sockets.adapter.rooms[padID]; - + if (room) { for (var id in room.sockets) { roomClients.push(socketio.sockets.sockets[id]); } } - + return roomClients; } diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index 24bc25c3..a564501d 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -178,6 +178,11 @@ exports.loglevel = "INFO"; exports.disableIPlogging = false; /** + * Number of seconds to automatically reconnect pad + */ +exports.automaticReconnectionTimeout = 0; + +/** * Disable Load Testing */ exports.loadTest = false; |