diff --git a/lib/transports-uws/polling.ts b/lib/transports-uws/polling.ts index 4ce6e52f..16e72c00 100644 --- a/lib/transports-uws/polling.ts +++ b/lib/transports-uws/polling.ts @@ -55,6 +55,8 @@ export class Polling extends Transport { */ onRequest(req) { const res = req.res; + // remove the reference to the ServerResponse object (as the first request of the session is kept in memory by default) + req.res = null; if (req.getMethod() === "get") { this.onPollRequest(req, res); diff --git a/lib/transports/polling.ts b/lib/transports/polling.ts index f0edcdc8..e5ea24cf 100644 --- a/lib/transports/polling.ts +++ b/lib/transports/polling.ts @@ -54,6 +54,8 @@ export class Polling extends Transport { */ onRequest(req: IncomingMessage & { res: ServerResponse }) { const res = req.res; + // remove the reference to the ServerResponse object (as the first request of the session is kept in memory by default) + req.res = null; if ("GET" === req.method) { this.onPollRequest(req, res);