Skip to content

Commit

Permalink
[fix] Save the value of the compress flag
Browse files Browse the repository at this point in the history
Fixes #983
  • Loading branch information
lpinca committed Feb 1, 2017
1 parent cb50a29 commit d856dcb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/Sender.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ class Sender {
if (options.fin) this.firstFragment = true;

if (this.perMessageDeflate) {
this.enqueue([this.sendCompressed, data, {
this.enqueue([this.dispatch, data, {
compress: this.compress,
mask: options.mask,
fin: options.fin,
readOnly,
Expand All @@ -239,21 +240,21 @@ class Sender {
}

/**
* Compresses, frames and sends a data message.
* Dispatches a data message.
*
* @param {Buffer} data The message to send
* @param {Object} options Options object
* @param {Number} options.opcode The opcode
* @param {Boolean} options.readOnly Specifies whether `data` can be modified
* @param {Boolean} options.fin Specifies whether or not to set the FIN bit
* @param {Boolean} options.compress Specifies whether or not to compress `data`
* @param {Boolean} options.mask Specifies whether or not to mask `data`
* @param {Boolean} options.rsv1 Specifies whether or not to set the RSV1 bit
* @param {Function} cb Callback
* @private
*/
sendCompressed (data, options, cb) {
if (!this.compress) {
options.rsv1 = false;
dispatch (data, options, cb) {
if (!options.compress) {
this.frameAndSend(data, options, cb);
this.continue();
return;
Expand Down

0 comments on commit d856dcb

Please sign in to comment.