Releases: jordanbyron/react-native-event-source
Version 1.1.0
Update EventSource to support chunked data (#21)
Previously, our copy of EventSource didn't work when a line came which hadn't been terminated with a new line (chunked data). In that case, the split('\n') call would give you junk data which the rest of the logic couldn't handle.
There might be another edge case where the XHR request finishes before the full line comes in but that's outside the scope of this change.
Version 1.0.5
Options argument is now truly optional, thanks to @davidsharp's work on #19
Version 1.0.4
Allow override of method
and body
via the options argument (#18)
Version 1.0.3
Make xhr.timeout configurable (#16) via the timeout
option.
const options = { timeout: 1000 }; // seconds
const eventSource = new RNEventSource('https://my-sse.com/stream', options);
Version 1.0.2
Bug Fix: Declare missing retry
variable (#15)
Version 1.0.1
Adds an optional argument to RNEventSource
for passing headers along to EventSource
. Handy for authorization.
const options = { headers: { Authorization: 'Baerer ...' } };
const eventSource = new RNEventSource('https://my-sse.com/stream', options);
Thanks to @dflourusso for the pull request!
Version 1.0.0
It's here! 1.0.0!!!! 🙌
This release includes a nice wrapper around interacting with event sources within your RN apps:
const eventSource = new RNEventSource('https://my-sse.com/stream');
eventSource.addEventListener('message', (event) => {
console.log(event.type); //=> message
console.log(event.data);
});
We've also moved from a pure Obj-C EventSource implementation to a Javascript implementation. This now allows this library to be used on Andriod RN apps. Hizza!
Version 0.1.0
Upgrade to the latest version of EventSource.
Kill connections on refresh
Prior to this release, refreshing in development mode wouldn't kill connections allowing them to stack up and cause odd behaviors. This release fixes that AND adds better error message support:
DeviceEventEmitter.addListener('EventSourceError', function(error) {
console.log(error.domain);
console.log(error.code);
console.log(error.description);
});
🚒 Enjoy!
Relax react-native dependency
Until 1.0 is released, let's say we support all 0.x.x
versions of react-native 👍