diff --git a/lib/faye/websocket/protocol8_parser.js b/lib/faye/websocket/protocol8_parser.js index 92add30..cecc952 100644 --- a/lib/faye/websocket/protocol8_parser.js +++ b/lib/faye/websocket/protocol8_parser.js @@ -230,8 +230,9 @@ var instance = { buffer.copy(frame, offset + insert); if (this._masking) { - mask = new Buffer([1,2,3,4].map(function() { return Math.floor(Math.random() * 256) })); - mask.copy(frame, header); + mask = [Math.floor(Math.random() * 256), Math.floor(Math.random() * 256), + Math.floor(Math.random() * 256), Math.floor(Math.random() * 256)]; + new Buffer(mask).copy(frame, header); Protocol8Parser.mask(frame, mask, offset); }