Disconnected state on warp's SSE


There's a question that even big AIs can't provide me a valuable answer to: how to add the ability to recognize when web browser is disconnected ("println!("client disconnected");") when using SSE (Server-Sent Events) in Rust's warp web framework, for example, in the simplest SSE example?

i would assume that whenever the client closes the stream warp will Drop the stream object. if you want to run arbitrary code on client disconnect for some reason, create a wrapper type that implements Drop and TryStream.

I'm not sure, but try enabling KeepAlive on the sse events, and add .recover(handle_rejection) as the next filter after the sse reply.