Update to make OT socket io handle error better, use delay to avoid wrong reversion on client

This commit is contained in:
Wu Cheng-Han 2016-10-10 20:40:45 +08:00
parent 73a8a6c32a
commit a090008d4a

View file

@ -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);
}
});
});