Server Sent Event (SSE) cluster connection handling
<p>At work we're currently building a webapp that supports <code>SSE</code>. <br>
We're all relatively new to <code>SSE</code>, so we're dealing with lot's of (newbie) questions:</p>

<h2>Disconnected connections</h2>

<p>When a client closes his browsers we end up with a disconnected connection. Some call it ghost connections I think.
<strong>How can we detect such connections at the server side?</strong> We want to delete those clients from the notification list.
<br></p>

<h2>Limit amount of connections</h2>

<p>I understood that each '<code>SSE-connection</code>' is kept alive on the <code>application server</code>.
When I shut down my development server, I directly notice on the browser debugger that connection felt away.
<strong>Shouldn't we set some upper limit of connections?</strong> <code>The application server</code> connections will get exhausted some time...
<br>
Additionally, some server dedicate a thread for each request. So that could lead to some thread exhausting issue...</p>

<h2>Application or web server</h2>

<p>Should the whole <code>SSE-broadcasting</code> be managed by an <code>application server</code> (where most request are business related) or should it be managed by some <code>web server</code> that is fully dedicated for handling <code>SSE-event</code>? At the moment, all business request and SSE-events are handled by a <code>Jboss</code> <code>application server</code>.</p>

<h2>Clustered environment</h2>

<p>How is SSE managed in a clustered environment applying an active-active mode 
(=master-master) where requests are routed randomly between instances? <br></p>

<p>If you have more useful information (and caveats to look out for) please feel free to share!</p>