Restruct
This commit is contained in:
15
node_modules/websocket-driver/lib/websocket/driver/hybi/message.js
generated
vendored
15
node_modules/websocket-driver/lib/websocket/driver/hybi/message.js
generated
vendored
@@ -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) {
|
||||
|
Reference in New Issue
Block a user