mpetazzoni/sse.js

Detect close

Closed this issue · 3 comments

Hi
Is it possible to detect when the SSE is closed?
Thanks!

If the connection is closed by the server, you should receive an abort event, which you need to listen for:

var source = new SSE(url, {start: false});
source.addEventListener('abort', function(e) { ... });
source.stream();

Thanks!

Don't receive abort event. Ended up using custom complete event.