3 var Message = function() {
14 if (this.data) return this.data;
16 this.data = new Buffer(this.length);
19 for (var i = 0, n = this._chunks.length; i < n; i++) {
20 this._chunks[i].copy(this.data, offset);
21 offset += this._chunks[i].length;
26 pushFrame: function(frame) {
27 this.rsv1 = this.rsv1 || frame.rsv1;
28 this.rsv2 = this.rsv2 || frame.rsv2;
29 this.rsv3 = this.rsv3 || frame.rsv3;
31 if (this.opcode === null) this.opcode = frame.opcode;
33 this._chunks.push(frame.payload);
34 this.length += frame.length;
38 for (var key in instance)
39 Message.prototype[key] = instance[key];
41 module.exports = Message;