diff --git a/lib/deceiver.js b/lib/deceiver.js index a249571..8e18d07 100644 --- a/lib/deceiver.js +++ b/lib/deceiver.js @@ -247,7 +247,7 @@ Deceiver.prototype.emitBody = function emitBody (buffer) { Deceiver.prototype._emitEmpty = function _emitEmpty () { // Emit data to force out handling of UPGRADE - var empty = new Buffer(0) + var empty = Buffer.alloc ? Buffer.alloc(0) : new Buffer(0) if (this.socket.ondata) { this.socket.ondata(empty, 0, 0) } else { this.socket.emit('data', empty) }