summaryrefslogtreecommitdiff
path: root/lib/ot
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlib/ot/editor-socketio-server.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ot/editor-socketio-server.js b/lib/ot/editor-socketio-server.js
index 9e4ddf96..45ed5036 100755
--- a/lib/ot/editor-socketio-server.js
+++ b/lib/ot/editor-socketio-server.js
@@ -10,7 +10,7 @@ var util = require('util');
var LZString = require('lz-string');
var logger = require('../logger');
-function EditorSocketIOServer(document, operations, docId, mayWrite) {
+function EditorSocketIOServer(document, operations, docId, mayWrite, operationCallback) {
EventEmitter.call(this);
Server.call(this, document, operations);
this.users = {};
@@ -18,6 +18,7 @@ function EditorSocketIOServer(document, operations, docId, mayWrite) {
this.mayWrite = mayWrite || function (_, cb) {
cb(true);
};
+ this.operationCallback = operationCallback;
}
util.inherits(EditorSocketIOServer, Server);
@@ -51,6 +52,8 @@ EditorSocketIOServer.prototype.addClient = function (socket) {
}
try {
self.onOperation(socket, revision, operation, selection);
+ if (typeof self.operationCallback === 'function')
+ self.operationCallback(socket, operation);
} catch (err) {
socket.disconnect(true);
}