fetch-event-source
fetch-event-source copied to clipboard
Should abort trigger onclose?
Hello!
While I was working with server-sent events I've discovered similar shortcomings as you. Glad your library exists to fix them!
One issue I've discovered with your library is that calling ctrl.abort()
won't result in either onclose
or onerror
calls. This makes it difficult to collocate code which is responsible of handling connection closing, be it by a server or manual.
Is there something I am missing? Would it make sense as a feature?
@gyzerok did you get any fixes for this, I am having the same kind of scenario where I need to stop the connection on a particular condition.
Please change to reject({ aborted:true })
here
https://github.com/Azure/fetch-event-source/blob/6fb7115ebacb90600b54383ea32f799f6f647203/src/fetch.ts#L97
Please change to
reject({ aborted:true })
herehttps://github.com/Azure/fetch-event-source/blob/6fb7115ebacb90600b54383ea32f799f6f647203/src/fetch.ts#L97
Has anyone tested this does fix the issue without other regressions? Should we create a PR?
As the same. I call thectrl.abort()
, but it is trigger neither onclose
or onerror
.
Is this fixed? Why is this closed?
Please change to
reject({ aborted:true })
here https://github.com/Azure/fetch-event-source/blob/6fb7115ebacb90600b54383ea32f799f6f647203/src/fetch.ts#L97Has anyone tested this does fix the issue without other regressions? Should we create a PR?
I think we can create a PR for this, let's see if I can have time for this. Of course need to keep an eye on the regressions, and I think maintainers can see if that can happen.