This commit is contained in:
2020-08-13 10:31:15 +02:00
parent 1ba0d7f9ba
commit 8d7722be91
3362 changed files with 13786 additions and 500745 deletions

View File

@@ -1,19 +1,26 @@
'use strict';
var Buffer = require('safe-buffer').Buffer;
var Message = function() {
this.rsv1 = false;
this.rsv2 = false;
this.rsv3 = false;
this.opcode = null;
this.opcode = null
this.length = 0;
this._chunks = [];
};
var instance = {
read: function() {
return this.data = this.data || Buffer.concat(this._chunks, this.length);
if (this.data) return this.data;
this.data = new Buffer(this.length);
var offset = 0;
for (var i = 0, n = this._chunks.length; i < n; i++) {
this._chunks[i].copy(this.data, offset);
offset += this._chunks[i].length;
}
return this.data;
},
pushFrame: function(frame) {