Skip to content

Commit d24d28a

Browse files
committed
call callback from finish event of long poll
1 parent 3be3a76 commit d24d28a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/engine.io/lib/transports/polling.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ export class Polling extends Transport {
274274
headers["Content-Length"] =
275275
"string" === typeof data ? Buffer.byteLength(data) : data.length;
276276
this.res.writeHead(200, this.headers(this.req, headers));
277+
this.res.once("finish", callback);
277278
this.res.end(data);
278-
callback();
279279
};
280280

281281
if (!this.httpCompression || !options.compress) {
@@ -298,8 +298,8 @@ export class Polling extends Transport {
298298
this.compress(data, encoding, (err, data) => {
299299
if (err) {
300300
this.res.writeHead(500);
301+
this.res.once("finish", callback);
301302
this.res.end();
302-
callback(err);
303303
return;
304304
}
305305

0 commit comments

Comments
 (0)