From e097622098b9c77a91f40306547b4b07fd258402 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 17 Oct 2016 18:11:28 +0800 Subject: [PATCH] Change to raise socket io reconnection attempts and make editor only available after refresh event received --- public/js/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index 5bddfbd0c..7294a5ba6 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -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(); });