Commit 7ba21cb4 authored by Moritz Langenstein's avatar Moritz Langenstein
Browse files

(ml5717) (alh1717) Removed pako compression (gives library users more control)

parent 9b066b28
......@@ -26,10 +26,6 @@ var _whatThePack = require('what-the-pack');
var _whatThePack2 = _interopRequireDefault(_whatThePack);
var _pako = require('pako');
var _pako2 = _interopRequireDefault(_pako);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
......@@ -52,7 +48,7 @@ function isAllTracksEnded(stream) {
var protoSend = RTCDataChannel.prototype.send;
RTCDataChannel.prototype.send = function (data) {
protoSend.apply(this, [_pako2.default.deflate(encode(data))]);
protoSend.apply(this, [encode(data)]);
};
var Peer = function (_WildEmitter) {
......@@ -234,7 +230,7 @@ var Peer = function (_WildEmitter) {
channel.onclose = this.emit.bind(this, 'channelClose', channel, peer);
channel.onerror = this.emit.bind(this, 'channelError', channel, peer);
channel.onmessage = function (event) {
self.emit('channelMessage', self, channel.label, decode(_whatThePack2.default.Buffer.from(_pako2.default.inflate(event.data))), channel, event);
self.emit('channelMessage', self, channel.label, decode(_whatThePack2.default.Buffer.from(event.data)), channel, event);
};
channel.onopen = this.emit.bind(this, 'channelOpen', channel, peer);
}
......
......@@ -3,7 +3,6 @@ import WildEmitter from 'wildemitter';
import FileTransfer from 'filetransfer';
import webrtcSupport from './webrtcsupport';
import MessagePack from 'what-the-pack';
import pako from 'pako';
const { encode, decode } = MessagePack.initialize(2**22);
......@@ -17,7 +16,7 @@ function isAllTracksEnded(stream) {
const protoSend = RTCDataChannel.prototype.send;
RTCDataChannel.prototype.send = function (data) {
protoSend.apply(this, [pako.deflate(encode(data))])
protoSend.apply(this, [encode(data)])
};
class Peer extends WildEmitter {
......@@ -179,7 +178,7 @@ class Peer extends WildEmitter {
channel.onclose = this.emit.bind(this, 'channelClose', channel, peer);
channel.onerror = this.emit.bind(this, 'channelError', channel, peer);
channel.onmessage = (event) => {
self.emit('channelMessage', self, channel.label, decode(MessagePack.Buffer.from(pako.inflate(event.data))), channel, event);
self.emit('channelMessage', self, channel.label, decode(MessagePack.Buffer.from(event.data)), channel, event);
};
channel.onopen = this.emit.bind(this, 'channelOpen', channel, peer);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment