mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-12 22:26:08 -04:00
Remove manual LZString compression for partial socket io event data
This commit is contained in:
parent
e65e09215a
commit
c904083d1f
5 changed files with 3 additions and 22 deletions
|
@ -7,7 +7,6 @@ var Server = require('./server');
|
|||
var Selection = require('./selection');
|
||||
var util = require('util');
|
||||
|
||||
var LZString = require('lz-string');
|
||||
var logger = require('../logger');
|
||||
|
||||
function EditorSocketIOServer(document, operations, docId, mayWrite, operationCallback) {
|
||||
|
@ -40,10 +39,8 @@ EditorSocketIOServer.prototype.addClient = function (socket) {
|
|||
revision: this.operations.length,
|
||||
clients: this.users
|
||||
};
|
||||
socket.emit('doc', LZString.compressToUTF16(JSON.stringify(docOut)));
|
||||
socket.emit('doc', docOut);
|
||||
socket.on('operation', function (revision, operation, selection) {
|
||||
operation = LZString.decompressFromUTF16(operation);
|
||||
operation = JSON.parse(operation);
|
||||
socket.origin = 'operation';
|
||||
self.mayWrite(socket, function (mayWrite) {
|
||||
if (!mayWrite) {
|
||||
|
@ -62,7 +59,7 @@ EditorSocketIOServer.prototype.addClient = function (socket) {
|
|||
clients: self.users,
|
||||
force: true
|
||||
};
|
||||
socket.emit('doc', LZString.compressToUTF16(JSON.stringify(docOut)));
|
||||
socket.emit('doc', docOut);
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
@ -129,7 +126,6 @@ EditorSocketIOServer.prototype.onGetOperations = function (socket, base, head) {
|
|||
var operations = this.operations.slice(base, head).map(function (op) {
|
||||
return op.wrapped.toJSON();
|
||||
});
|
||||
operations = LZString.compressToUTF16(JSON.stringify(operations));
|
||||
socket.emit('operations', head, operations);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue