@@ -3,6 +3,7 @@ import { createGzip, createDeflate } from "zlib";
3
3
import * as accepts from "accepts" ;
4
4
import debugModule from "debug" ;
5
5
import { HttpRequest , HttpResponse } from "uWebSockets.js" ;
6
+ import { Packet } from "engine.io-parser" ;
6
7
7
8
const debug = debugModule ( "engine:polling" ) ;
8
9
@@ -253,7 +254,7 @@ export class Polling extends Transport {
253
254
* @param {Object } packet
254
255
* @private
255
256
*/
256
- send ( packets ) {
257
+ send ( packets : Packet [ ] ) {
257
258
this . writable = false ;
258
259
259
260
if ( this . shouldClose ) {
@@ -263,11 +264,11 @@ export class Polling extends Transport {
263
264
this . shouldClose = null ;
264
265
}
265
266
266
- const doWrite = ( data ) => {
267
+ const doWrite = ( data : string ) => {
267
268
const compress = packets . some ( ( packet ) => {
268
269
return packet . options && packet . options . compress ;
269
270
} ) ;
270
- this . write ( data , { compress } ) ;
271
+ this . write ( data , { compress, source : packets } ) ;
271
272
} ;
272
273
273
274
if ( this . protocol === 3 ) {
@@ -288,7 +289,7 @@ export class Polling extends Transport {
288
289
debug ( 'writing "%s"' , data ) ;
289
290
this . doWrite ( data , options , ( ) => {
290
291
this . req . cleanup ( ) ;
291
- this . emit ( "drain" ) ;
292
+ this . emit ( "drain" , options . source ) ;
292
293
} ) ;
293
294
}
294
295
0 commit comments