I have a Spring Boot application with an endpoint, that returns a org.springframework.web.servlet.mvc.method.annotation.SseEmitter.
Multiple clients connect to my backend and their SseEmitters get stored (in memory), so that they can send each other messages via another endpoint, which the server then forwards to all connected emitters.
My problem is, that the SseEmitter class only has onCompletion, onError and onTimeout events. Neither of them gets called when a client simply disconnects.
Is there a way to see when a connection gets disconnected? Or maybe a way to get the underlying socket and listen for it to close or something?