react-native-sse icon indicating copy to clipboard operation
react-native-sse copied to clipboard

Event Listeners Not Triggering in Expo Environment

Open sudo2801 opened this issue 1 year ago • 3 comments

I'm facing an issue where event listeners for 'message' and 'error' aren't being invoked when using the library within an Expo app, despite the EventSource connection being established.

Environment:

Expo SDK Version: 51.0.0 Platform: Android, iOS

Expected Behavior: The 'message' event listener should be invoked when the server sends an event, and the 'error' event listener should be triggered in case of connection errors.

I kindly request your assistance in resolving this issue. Please let me know if you require further information or have any suggestions.

sudo2801 avatar Nov 08 '24 05:11 sudo2801

It's possible that Expo's dev tools interceptor is blocking the event-stream. See https://github.com/expo/expo/issues/27526

Here is a possible fix: https://github.com/MartinHarkins/expo-sse-patch

EmilJunker avatar Nov 08 '24 06:11 EmilJunker

@EmilJunker The Same issue is there with React-Native-CLI as well.

It was working around a week ago, but suddenly it is not working.

    "react": "^18.2.0",
    "react-native": "^0.73.9",
    "react-native-sse": "^1.2.1"
And in android it is not triggering due to that using workaround with

"react-native-oksse": "^0.2.0",

Please someone help around on this issue fix

amit13091992 avatar Nov 19 '24 11:11 amit13091992

Same issue here in Expo 51, we receive the open event but no others.

mocon avatar Mar 26 '25 00:03 mocon