Skip to content

Commit

Permalink
fix: handle client close event (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
didavid61202 authored Sep 1, 2023
1 parent f8cde14 commit d301da5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/middleware/web-incoming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ const stream = defineProxyMiddleware(
server.emit("end", req, res, proxyRes);
}
} else {
// EventSource close
res.on("close", function () {
proxyRes.destroy();
});
// Allow us to listen when the proxy has completed
proxyRes.on("end", function () {
if (server) {
Expand Down

0 comments on commit d301da5

Please sign in to comment.