Skip to content

Commit a090008

Browse files
committed
Update to make OT socket io handle error better, use delay to avoid wrong reversion on client
1 parent 73a8a6c commit a090008

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

lib/ot/editor-socketio-server.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@ EditorSocketIOServer.prototype.addClient = function (socket) {
5555
if (typeof self.operationCallback === 'function')
5656
self.operationCallback(socket, operation);
5757
} catch (err) {
58-
socket.disconnect(true);
58+
setTimeout(function() {
59+
var docOut = {
60+
str: self.document,
61+
revision: self.operations.length,
62+
clients: self.users,
63+
force: true
64+
};
65+
socket.emit('doc', LZString.compressToUTF16(JSON.stringify(docOut)));
66+
}, 100);
5967
}
6068
});
6169
});

0 commit comments

Comments
 (0)