react-native-eventsource
react-native-eventsource copied to clipboard
A react-native component for EventSource: Server-Sent Events for iOS and Android
most issues were because the import statment it has to be import instead of import "RNEventSource.h"
Some build environments need to use #import to pull in the react bridge. Other projects such as react-native-orientation do this: https://github.com/yamill/react-native-orientation/blob/master/iOS/RCTOrientation/Orientation.h#L7-L11
I am facing a problem trying to initialize the EventSource. ```` componentDidMount() { this.source = new EventSource("url_to_my_channel"); this.source.onopen = () => console.log("EventSource::Connection open"); this.source.onmessage = (message) => console.log("EventSource::onMessage", message); this.source.onerror...
this could probably just be `data: ev.data` but leaving it as `data: ev.message || ev.data` should be non breaking fixes #9
I encountered an [issue](https://github.com/neilco/EventSource/issues/16) with this library https://github.com/neilco/EventSource. So I moved to more reliable https://github.com/travisjeffery/TRVSEventSource library. It works like a charm.
If server sent event contains "data" property, it is ignored, but "message" used instead: https://github.com/JonnyBGod/react-native-eventsource/blob/master/src/EventSource.js#L58 ``` var event = new EventSourceEvent(ev.type, { data: ev.message }); ```
sse has more than a `data` field. It can include an `event`, or `id` (amongst some others). `event` in this lib should conform sse events.
I'm using springboot SseEmitter as a backend. Why the `closeEventListener` is not called when emitter is closed. On the contrary, `ErrorEventListener` is called.