You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you so much for providing this repo ❤️ . We use streams for our subscribe requests and I was able to integrate with your project in order to get streaming working on iOS. However, I'm still running into an issue where Android is behaving as it did before the web stream polyfill. I can see the subscribe request come through, but it just hangs and no data ever comes through.
To reproduce, you can run the app & press Generate address. Then press Send gm. That should trigger a message to come through the stream. If you have a chance to take a look, I'm so curious what could be causing Android specifically to have trouble here.
JS env: Hermes
RN version: 0.71
All polyfills should be included as well in .polyfills.js
Reacted by nplasterer, Philipp Walter, Kobie Botha, ReMuSoMeGA93 and Andrey Gubanov
@acostalima tagging just so this doesn't get lost in the sea of notifications. I think we'll recommend a polling solution on our end for the time being but would love a quick glance if you get a chance!
Thanks for reaching out @elisealix22.
I'm afraid I won't be able to address this in the short term. Furthermore, I haven't worked with RN since v0.64.
I haven't tested streaming against Hermes at the time. Does it work in JavaScriptCore, even on RN v0.71?
Did you check the changelogs of RN v0.64-0.71 to see if there were any changes to the Networking API?
Thank you so much for the response! This is excellent context. I'll give JSC a shot and check out the RN networking diff as I haven't tried either yet!
Hey guys, @alessbell The fetch works for Android but in release mode. To make it work on development mode do the following things. Cannot take full credit for this but I found this from here
Solution 1:
go to android/app/src/debug/java/com//ReactNativeFlipper.java
comment NetworkFlipperPlugin like this:
client.addPlugin(CrashReporterPlugin.getInstance());
// todo commented because of this issue binaryminds/react-native-sse#3meta/flipper#2495
// NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
// NetworkingModule.setCustomClientBuilder(
// new NetworkingModule.CustomClientBuilder() {
// @OverRide
// public void apply(OkHttpClient.Builder builder) {
// builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
// }
// });
// client.addPlugin(networkFlipperPlugin);
client.start();
Solution 2:
If you don't want to comment the NetworkFlipperPlugin.
This bug happen only in debug, so instead of running:
react-native run-android You have to run:
react-native run-android --variant=release Or simply change it in your package.json
{
// ...
"scripts": {
"android": "react-native run-android --variant=release", // here
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
// ...
}
Reacted by Alessia Bellisario, martin, Philipp Walter, Kræn Hansen, Heeth Jain, Akbar Bakhshi and Alessandro Duico
@Raythode Thanks for the solutions. I commented NetworkFlipperPlugin as you mentioned in solution 1 and it worked. Follow-up question though: do I need to uncomment those for production? it seems like the fetch streaming should work for the release version according to your comment.
Activity
elisealix22 commentedon Dec 16, 2022
@acostalima tagging just so this doesn't get lost in the sea of notifications. I think we'll recommend a polling solution on our end for the time being but would love a quick glance if you get a chance!
acostalima commentedon Dec 20, 2022
Thanks for reaching out @elisealix22.
I'm afraid I won't be able to address this in the short term. Furthermore, I haven't worked with RN since v0.64.
I haven't tested streaming against Hermes at the time. Does it work in JavaScriptCore, even on RN v0.71?
Did you check the changelogs of RN v0.64-0.71 to see if there were any changes to the Networking API?
elisealix22 commentedon Dec 20, 2022
Thank you so much for the response! This is excellent context. I'll give JSC a shot and check out the RN networking diff as I haven't tried either yet!
fa2id commentedon Feb 22, 2023
@elisealix22 Hey, did you try this with the latest versions of RN? Is it working on iOS and Android? Thank you!
a289459798 commentedon May 26, 2023
0.71.7 same
alessbell commentedon Sep 1, 2023
After doing a bit of investigating I've opened an issue for this over on the RN repo: react/react-native#39260
Edit: this doesn't actually appear to be related (but probably still a bug) 😅
Raythode commentedon Sep 1, 2023
Hey guys, @alessbell The fetch works for Android but in release mode. To make it work on development mode do the following things. Cannot take full credit for this but I found this from here
Solution 1:
go to android/app/src/debug/java/com//ReactNativeFlipper.java
comment NetworkFlipperPlugin like this:
client.addPlugin(CrashReporterPlugin.getInstance());
// todo commented because of this issue binaryminds/react-native-sse#3 meta/flipper#2495
// NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
// NetworkingModule.setCustomClientBuilder(
// new NetworkingModule.CustomClientBuilder() {
// @OverRide
// public void apply(OkHttpClient.Builder builder) {
// builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
// }
// });
// client.addPlugin(networkFlipperPlugin);
client.start();
Solution 2:
If you don't want to comment the NetworkFlipperPlugin.
This bug happen only in debug, so instead of running:
react-native run-android You have to run:
react-native run-android --variant=release Or simply change it in your package.json
{
// ...
"scripts": {
"android": "react-native run-android --variant=release", // here
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
// ...
}
feat: add react-native streams support (#55)
AkbarBakhshi commentedon Feb 19, 2024
@Raythode Thanks for the solutions. I commented NetworkFlipperPlugin as you mentioned in solution 1 and it worked. Follow-up question though: do I need to uncomment those for production? it seems like the fetch streaming should work for the release version according to your comment.
Raythode commentedon Feb 20, 2024
@AkbarBakhshi yes, it should work as expected in release/prod. No need to comment.