diff --git a/lib/ws/connection.js b/lib/ws/connection.js index 62de57f..d2cf1bb 100644 --- a/lib/ws/connection.js +++ b/lib/ws/connection.js @@ -14,8 +14,9 @@ var _events = require('../_events'); var Mixin = require('../lang/mixin'); var CLOSE_FRAME = new Buffer(2); - CLOSE_FRAME[0] = 0xFF; - CLOSE_FRAME[1] = 0x00; + +CLOSE_FRAME[0] = 0xFF; +CLOSE_FRAME[1] = 0x00; /*----------------------------------------------- The Connection: @@ -287,12 +288,12 @@ Connection.prototype.inspect = function() { Connection.prototype.write = function(data) { if (this._state === 4) { var byteLen = Buffer.byteLength(data, 'utf8'), - bytes = new Buffer(byteLen+2); - + bytes = new Buffer(byteLen + 2); + bytes[0] = 0x00; bytes.write(data, 1, 'utf8'); bytes[byteLen + 1] = 0xFF; - + return write(this, bytes); } else { debug(this.id, '\033[31mCould not send.');