Change to raise socket io reconnection attempts and make editor only available after refresh event received

This commit is contained in:
Wu Cheng-Han 2016-10-17 18:11:28 +08:00
parent 70a52e2eae
commit e097622098

View file

@ -2262,7 +2262,8 @@ window.havePermission = havePermission;
var io = require("socket.io-client");
var socket = io.connect({
path: urlpath ? '/' + urlpath + '/socket.io/' : '',
timeout: 5000 //5 secs to timeout
timeout: 5000, //5 secs to timeout,
reconnectionAttempts: 20 // retry 20 times on connect failed
});
//overwrite original event for checking login state
var on = socket.on;
@ -2636,6 +2637,8 @@ socket.on('refresh', function (data) {
scrollToHash();
}, 1);
}
if (editor.getOption('readOnly'))
editor.setOption('readOnly', false);
});
var EditorClient = ot.EditorClient;
@ -2689,9 +2692,6 @@ socket.on('doc', function (obj) {
updateView();
}
if (editor.getOption('readOnly'))
editor.setOption('readOnly', false);
restoreInfo();
});