From 4e834e2bfeaeeda33e26eebd1bd86c841c1dc228 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Fri, 21 Jun 2024 13:43:01 +0200 Subject: [PATCH] refactor: move the `req` attribute to the polling class --- lib/transport.ts | 8 ++------ lib/transports-uws/polling.ts | 1 + lib/transports/polling.ts | 1 + 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/transport.ts b/lib/transport.ts index 6a9f3ca0..53d7b211 100644 --- a/lib/transport.ts +++ b/lib/transport.ts @@ -54,7 +54,6 @@ export abstract class Transport extends EventEmitter { * @protected */ protected parser: any; - protected req: EngineRequest; /** * Whether the transport supports binary payloads (else it will be base64-encoded) * @protected @@ -99,13 +98,10 @@ export abstract class Transport extends EventEmitter { /** * Called with an incoming HTTP request. * - * @param {http.IncomingMessage} req + * @param req * @package */ - onRequest(req) { - debug("setting request"); - this.req = req; - } + onRequest(req: any) {} /** * Closes the transport. diff --git a/lib/transports-uws/polling.ts b/lib/transports-uws/polling.ts index 1fc643f8..090270ec 100644 --- a/lib/transports-uws/polling.ts +++ b/lib/transports-uws/polling.ts @@ -15,6 +15,7 @@ export class Polling extends Transport { public maxHttpBufferSize: number; public httpCompression: any; + private req: HttpRequest & { cleanup: () => void }; private res: HttpResponse; private dataReq: HttpRequest; private dataRes: HttpResponse; diff --git a/lib/transports/polling.ts b/lib/transports/polling.ts index 3b477a62..1f463359 100644 --- a/lib/transports/polling.ts +++ b/lib/transports/polling.ts @@ -16,6 +16,7 @@ export class Polling extends Transport { public maxHttpBufferSize: number; public httpCompression: any; + private req: EngineRequest; private res: ServerResponse; private dataReq: IncomingMessage; private dataRes: ServerResponse;