Streaming response disconnect hook
I'm experimenting with a worker that responds with an indefinite
ReadableStream - for the sake of this example, let's just say that it sends the current time as a string every second. I'd like to know when the client manually disconnects, and when that happens, write the number of messages I've sent until that point to a data store. Is there any way to achieve this reliably with Workers? I'm primarily interested in Rust, but would also be interested in a TS/JS solution.