rn-eventsource
rn-eventsource copied to clipboard
Does not work on Android
This library is great and it works well on iOS. However, it doesn't work on my Android device or my Android emulator. I have posted details about it here:
https://github.com/facebook/react-native/issues/28835
Hello,
I confirm, it does not work on android (messages never arrive), I am desperately looking for a solution: /
Can you help me ? thank you in advance
It works just fine. I had the same issue and the solution was to:
- stick to a different library like
import RNEventSource from 'react-native-event-source'
. - deeply understand how the server works. In my case I was subscribed to the
message
event, but server-side guys did their own custom events like 'session_approved' and 'session_rejected'. So I was just listening to wrong events.es.addEventListener(SessionStatus.session_rejected, (event: { data: string }) => { bla-bla-bla}
@kovkev @GaylordP what I can recommend you guys is to double check everything, try to debug last-event-id
comes from the server. Try to debug other events, not just the ones you are subscribed to. Try 'react-native-event-source'. Discuss the architecture - why not data-only-push notifications? Eventsource will only work while the App in foreground ☝🏻
Also ensure you are not connecting via http
on Android
Also try with a real device