I'm returning a stream here for SSE. I wanted to know if it's possible to get a callback when the client closes the connection? Because I need to close the stream and unsubscribe the client then
return new Response(responseStream.readable, {
status: 200,
headers: {
Connection: "keep-alive",
"Cache-Control": "no-cache, no-transform",
"Content-Type": "text/event-stream",
"Access-Control-Allow-Origin": "*",
//nginx disable buffering
"X-Accel-Buffering": "no",
},
});```