Skip to content Skip to sidebar Skip to footer

How To Close An Unbounded And Piped Stream Request In Node?

My node/express application has an endpoint that's proxying a stream of data from an internal service, which is using server-sent events. This means the internal service will conti

Solution 1:

When you're making a request in Node, there is the abort() method. It will close your request stream.

req.on('close', () => {
  // ...close connection to internal service
  stream.abort()
});

Post a Comment for "How To Close An Unbounded And Piped Stream Request In Node?"