Merge pull request #3085 from Gared/fix_socketio_options

Updated option parameters for socket.io to work with latest version
pull/3000/head
Stefan 2016-12-12 23:40:29 +01:00 committed by GitHub
commit da5ae8b1f7
2 changed files with 11 additions and 24 deletions

View File

@ -16,7 +16,7 @@
"request" : "2.55.0", "request" : "2.55.0",
"etherpad-require-kernel" : "1.0.9", "etherpad-require-kernel" : "1.0.9",
"resolve" : "1.1.7", "resolve" : "1.1.7",
"socket.io" : "1.4.5", "socket.io" : "1.6.0",
"ueberdb2" : "0.3.0", "ueberdb2" : "0.3.0",
"express" : "4.13.4", "express" : "4.13.4",
"express-session" : "1.13.0", "express-session" : "1.13.0",

View File

@ -231,40 +231,27 @@ function handshake()
// Allow deployers to host Etherpad on a non-root path // Allow deployers to host Etherpad on a non-root path
'path': exports.baseURL + "socket.io", 'path': exports.baseURL + "socket.io",
'resource': resource, 'resource': resource,
'max reconnection attempts': 3, 'reconnectionAttempts': 5,
'sync disconnect on unload' : false 'reconnection' : true,
'reconnectionDelay' : 1000,
'reconnectionDelayMax' : 5000
}); });
var disconnectTimeout;
socket.once('connect', function () { socket.once('connect', function () {
sendClientReady(false); sendClientReady(false);
}); });
socket.on('reconnect', function () { socket.on('reconnect', function () {
//reconnect is before the timeout, lets stop the timeout
if(disconnectTimeout)
{
clearTimeout(disconnectTimeout);
}
pad.collabClient.setChannelState("CONNECTED"); pad.collabClient.setChannelState("CONNECTED");
pad.sendClientReady(true); pad.sendClientReady(true);
}); });
socket.on('disconnect', function (reason) { socket.on('reconnecting', function() {
if(reason == "booted"){ pad.collabClient.setChannelState("RECONNECTING");
pad.collabClient.setChannelState("DISCONNECTED"); });
} else {
function disconnectEvent() socket.on('reconnect_failed', function(error) {
{ pad.collabClient.setChannelState("DISCONNECTED", "reconnect_timeout");
pad.collabClient.setChannelState("DISCONNECTED", "reconnect_timeout");
}
pad.collabClient.setChannelState("RECONNECTING");
disconnectTimeout = setTimeout(disconnectEvent, 20000);
}
}); });
var initalized = false; var initalized = false;