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

SSE doesn't work on ANDROID RN 0.74 withouth Flipper

Open taniibarra opened this issue 1 year ago • 11 comments

My application does not receive events in android but it does in ios. We don't have the Flipper java plugign and still in DEBUG mode it is only in [EventSource] Will open new connection in 500 ms. After that nothing else arrives. In IOS it works correctly and events continue to arrive.

taniibarra avatar Jul 05 '24 18:07 taniibarra

I'm using this library on React Native 0.74 without issues. There must be some problem with your code.

Have you checked if the problem also occurs in RELEASE mode?

EmilJunker avatar Jul 06 '24 08:07 EmilJunker

i'm getting the same problem in "react-native": "0.71.8" and "react-native-sse": "^1.1.0". I have tried using version 1.2.1 but it still doesn't work.

i tried creating a new project "react-native": "0.74.3" and used "react-native-sse": "^1.2.1" for this one worked fine. are there any changes that need to be adjusted for previous versions of react native?

NurRachman avatar Jul 17 '24 09:07 NurRachman

@NurRachman In version 0.74 of react-native, the Flipper plugin was removed. That's why react-native-sse is now working right out of the box.

In older versions of react-native, you need to manually disable Flipper. As long as Flipper is enabled, SSE won't work in debug builds.

EmilJunker avatar Jul 17 '24 09:07 EmilJunker

@EmilJunker I've tried it, and it works. Thanks.

NurRachman avatar Jul 18 '24 05:07 NurRachman

any updates on this? Need a fix for this issue. Here are my package version information

"react": "18.2.0",
"react-native": "^0.73.6",
"react-native-sse": "^1.2.1",

amit13091992 avatar Jul 29 '24 07:07 amit13091992

@amit13091992 You need to disable Flipper, see https://stackoverflow.com/questions/69235694/react-native-cant-connect-to-sse-in-android/69235695#answer-69235695

As long as Flipper is enabled, SSE won't work in debug builds on Android.

EmilJunker avatar Jul 29 '24 07:07 EmilJunker

@amit13091992 You need to disable Flipper, see https://stackoverflow.com/questions/69235694/react-native-cant-connect-to-sse-in-android/69235695#answer-69235695

As long as Flipper is enabled, SSE won't work in debug builds on Android.

@EmilJunker this file is not available in my project, as I am using the new version of react-native.

amit13091992 avatar Jul 29 '24 09:07 amit13091992

this file is not available in my project, as I am using the new version of react-native.

Just search your project for the word "Flipper". I assure you that you will find it somewhere.

EmilJunker avatar Jul 29 '24 10:07 EmilJunker

Hello everyone,

I checked the case yesterday and in the latest version of React Native (0.74.3), the issue does not occur. I also checked version React Native (0.73.6) and I have to confirm that the problem occurs. In Expo 51, event-stream is blocked by the dev tools interceptor. Theoretically, the problem has been resolved, but for some reason, events are not dispatched until the stream ends.

Ref: https://github.com/expo/expo/issues/27526

wojciechkrol avatar Jul 30 '24 11:07 wojciechkrol

In Expo 51, event-stream is blocked by the dev tools interceptor.

There is supposedly a fix for the Expo dev tools interceptor, available here: https://github.com/MartinHarkins/expo-sse-patch Did you try it?

EmilJunker avatar Jul 30 '24 12:07 EmilJunker

Hi, @EmilJunker – Have you guys considered adding a note to the README telling people to disable Flipper for RN < 0.74, specifically for Android in debug? I ran into this problem myself and fortunately found this thread relatively quickly. Others might not be so lucky if they're working purely from the install instructions in the README. Just a suggestion :)

Off2Race avatar Aug 31 '24 12:08 Off2Race