I am using jersey to implement a web app involves SSE.
The server keeps connections alive. And push data to clients
periodically.
In my scenario, there is a connection limit, only a certain number of
clients can subscribe to the server at the same time.
So when a new client is trying to subscribe, I do a
check(EventOutput.isClosed) to see if any old connections are not
active anymore, so they can make room for new connections.
But the result of EventOutput.isClosed is always false. When I close
the browser tab or the whole browser that initiated the connection, the
server side still thinks the connection is not closed. I have also
tried using curl to establish the connection and then quit curl, it
also did not make the EventOutput.isClosed return true.
This means that if a client drops accidentally(power outage or internet
cutoff), it's still hogging the connection, and new clients can not
subscribe.
Is there a work around for this?