diff --git a/src/sse_handler_middleware.ts b/src/sse_handler_middleware.ts index bad6844..0ae4eed 100644 --- a/src/sse_handler_middleware.ts +++ b/src/sse_handler_middleware.ts @@ -35,7 +35,7 @@ export function sseHandler(options: Partial = {}): Handle res.write(': sse-keep-alive\n'); }, keepAliveInterval); - res.on('close', () => clearInterval(keepAliveTimer)); + res.once('close', () => clearInterval(keepAliveTimer)); //=> Done next();