@@ -55,7 +55,7 @@ class Sender {
55
55
buf . writeUInt16BE ( code || 1000 , 0 , true ) ;
56
56
if ( buf . length > 2 ) buf . write ( data , 2 ) ;
57
57
58
- if ( this . perMessageDeflate ) {
58
+ if ( this . deflating ) {
59
59
this . enqueue ( [ this . doClose , buf , mask , cb ] ) ;
60
60
} else {
61
61
this . doClose ( buf , mask , cb ) ;
@@ -101,7 +101,7 @@ class Sender {
101
101
}
102
102
}
103
103
104
- if ( this . perMessageDeflate ) {
104
+ if ( this . deflating ) {
105
105
this . enqueue ( [ this . doPing , data , mask , readOnly ] ) ;
106
106
} else {
107
107
this . doPing ( data , mask , readOnly ) ;
@@ -147,7 +147,7 @@ class Sender {
147
147
}
148
148
}
149
149
150
- if ( this . perMessageDeflate ) {
150
+ if ( this . deflating ) {
151
151
this . enqueue ( [ this . doPong , data , mask , readOnly ] ) ;
152
152
} else {
153
153
this . doPong ( data , mask , readOnly ) ;
@@ -214,14 +214,20 @@ class Sender {
214
214
if ( options . fin ) this . firstFragment = true ;
215
215
216
216
if ( this . perMessageDeflate ) {
217
- this . enqueue ( [ this . dispatch , data , {
217
+ const opts = {
218
218
compress : this . compress ,
219
219
mask : options . mask ,
220
220
fin : options . fin ,
221
221
readOnly,
222
222
opcode,
223
223
rsv1
224
- } , cb ] ) ;
224
+ } ;
225
+
226
+ if ( this . deflating ) {
227
+ this . enqueue ( [ this . dispatch , data , opts , cb ] ) ;
228
+ } else {
229
+ this . dispatch ( data , opts , cb ) ;
230
+ }
225
231
} else {
226
232
this . frameAndSend ( data , {
227
233
mask : options . mask ,
@@ -366,7 +372,6 @@ class Sender {
366
372
enqueue ( params ) {
367
373
if ( params [ 1 ] ) this . bufferedBytes += params [ 1 ] . length ;
368
374
this . queue . push ( params ) ;
369
- this . dequeue ( ) ;
370
375
}
371
376
}
372
377
0 commit comments