Updated option parameters for socket.io to work with latest version
parent
602fd4629a
commit
39a3bedb7b
|
@ -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("DISCONNECTED");
|
|
||||||
} else {
|
|
||||||
function disconnectEvent()
|
|
||||||
{
|
|
||||||
pad.collabClient.setChannelState("DISCONNECTED", "reconnect_timeout");
|
|
||||||
}
|
|
||||||
|
|
||||||
pad.collabClient.setChannelState("RECONNECTING");
|
pad.collabClient.setChannelState("RECONNECTING");
|
||||||
|
});
|
||||||
|
|
||||||
disconnectTimeout = setTimeout(disconnectEvent, 20000);
|
socket.on('reconnect_failed', function(error) {
|
||||||
}
|
pad.collabClient.setChannelState("DISCONNECTED", "reconnect_timeout");
|
||||||
});
|
});
|
||||||
|
|
||||||
var initalized = false;
|
var initalized = false;
|
||||||
|
|
Loading…
Reference in New Issue