Skip to content

Commit

Permalink
fix(sse_handler_middleware): detach event listener on connection clos…
Browse files Browse the repository at this point in the history
…e with once()
  • Loading branch information
toverux committed May 28, 2017
1 parent 0ebcb3c commit 0fa831f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sse_handler_middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function sseHandler(options: Partial<ISseMiddlewareOptions> = {}): Handle
res.write(': sse-keep-alive\n');
}, keepAliveInterval);

res.on('close', () => clearInterval(keepAliveTimer));
res.once('close', () => clearInterval(keepAliveTimer));

//=> Done
next();
Expand Down

0 comments on commit 0fa831f

Please sign in to comment.