diff options
author | Wu Cheng-Han | 2016-10-10 20:40:45 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2016-10-10 20:40:45 +0800 |
commit | a090008d4ae7eb69d0403b2dec43605bc981b19a (patch) | |
tree | e285a55ddd18490c63f619c1947b9b4e53f6a31f /lib/ot | |
parent | 73a8a6c32a1e00c3c34b2c060022ba14419e5bc5 (diff) |
Update to make OT socket io handle error better, use delay to avoid wrong reversion on client
Diffstat (limited to 'lib/ot')
-rwxr-xr-x | lib/ot/editor-socketio-server.js | 10 |
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); } }); }); |