summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Cheng-Han2016-10-10 20:40:45 +0800
committerWu Cheng-Han2016-10-10 20:40:45 +0800
commita090008d4ae7eb69d0403b2dec43605bc981b19a (patch)
treee285a55ddd18490c63f619c1947b9b4e53f6a31f
parent73a8a6c32a1e00c3c34b2c060022ba14419e5bc5 (diff)
Update to make OT socket io handle error better, use delay to avoid wrong reversion on client
-rwxr-xr-xlib/ot/editor-socketio-server.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/ot/editor-socketio-server.js b/lib/ot/editor-socketio-server.js
index 45ed5036..d062fa19 100755
--- a/lib/ot/editor-socketio-server.js
+++ b/lib/ot/editor-socketio-server.js
@@ -55,7 +55,15 @@ EditorSocketIOServer.prototype.addClient = function (socket) {
if (typeof self.operationCallback === 'function')
self.operationCallback(socket, operation);
} catch (err) {
- socket.disconnect(true);
+ setTimeout(function() {
+ var docOut = {
+ str: self.document,
+ revision: self.operations.length,
+ clients: self.users,
+ force: true
+ };
+ socket.emit('doc', LZString.compressToUTF16(JSON.stringify(docOut)));
+ }, 100);
}
});
});