rn-eventsource icon indicating copy to clipboard operation
rn-eventsource copied to clipboard

Does not work on Android

Open kovkev opened this issue 4 years ago • 4 comments

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

kovkev avatar May 16 '20 05:05 kovkev

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

GaylordP avatar Mar 29 '21 19:03 GaylordP

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