title: How to determine that an SSE connection was closed?
body: <p>We have an SSE (Server-Sent Events) connection open in JavaScript which can time to time get closed, either because of server restarts or other causes. In that case it would be good to reestablish the connection. How to do it? Is there a way to find out on the client side that the connection was closed?</p>
  <p>Here: <a href="https://developer.mozilla.org/en-US/docs/Web/API/EventSource" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/EventSource</a> I found only a way to close the connection, but no callback or a test method for determining whether the connection is still alive.</p>
  <p>Thank you for your help.</p>