summaryrefslogtreecommitdiff
path: root/src/node/handler/PadMessageHandler.js
diff options
context:
space:
mode:
authorLuiza Pagliari <lpagliari@gmail.com>2017-04-04 11:09:24 -0300
committerLuiza Pagliari <lpagliari@gmail.com>2017-04-04 11:09:24 -0300
commit009cd3124370d44a9c567332bf3be63826fd95b4 (patch)
tree233f9fe1f26a5188d42461139d862bd7ff30029f /src/node/handler/PadMessageHandler.js
parented029b599ee83edefd37b14dc44275b24316bf91 (diff)
downloadetherpad-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/handler/PadMessageHandler.js')
-rw-r--r--src/node/handler/PadMessageHandler.js9
1 files changed, 5 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;
}