react-native-sse
react-native-sse copied to clipboard
Can we add a 'done' event?
Thanks in advance! My usage looks like this.
es = new EventSource(url, {
debug: debug,
headers: headers,
pollingInterval: 0, // Set pollingInterval to 0 to disable reconnections
})
I set pollingInterval
to 0
as suggested in the README because otherwise it would reconnect and I don't need reconnections. However, I do want to know when the request "finishes".
The server closing does not trigger a close
event, which seems to be by design. But I noticed [EventSource][onreadystatechange][DONE] Operation done.
in the debug logs. That is exactly what I need to know in my code, but there's no event!
I forked the source locally, added the event, and things work perfectly 👌. The actual change is only a handful of lines, so I can easily make a PR. Just wanted to get a 👍 first.