Categories
express javascript node.js server-sent-events

How to close HTTP connection in node.js using Express

I use node.js (Express) with server-sent events. I would like to close the event stream by closing the sse HTTP connection. Given the folllwing function:

router.get('/sse', function (req, res) {
});

how can this be achieved?