-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The data is logged only after the stream ends. #26
Comments
@CelestialAzure did you fix this issue? I experience the same one. |
The problem is with Flipper. This will fix the issue facebook/react-native#28835 (comment) |
I have the same issue on iOS |
I'm guessing the fix is still underway? |
The problem is not on our side. We cannot fix it. As it stands, any kind of SSE connections (regardless of which library you use) will not work in React Native debug builds on Android. Here is what you can do: A) Build your app in release mode. The SSE connection should work just fine then. B) Disable Flipper by commenting out the corresponding lines of code in some Java/Kotlin file located under the android folder of your project. The exact location depends on the React Native version you're using. In newer versions of React Native, I think it's somewhere in the MainActivity or MainApplication file. Once you've commented out Flipper, SSE should work also in debug builds. C) Possibly wait for the next major release of React Native which (if I understand it correctly) will no longer include Flipper by default, so there is a chance this issue will just resolve itself: https://reactnative.dev/blog/2023/12/06/0.73-debugging-improvements-stable-symlinks#flipper--react-native-integration |
@EmilJunker, thanks for the info. |
The server sent stream data is only logged on console once the entire stream ends. Not sure how to go about fixing this.
const url = new URL("....");
const es = new EventSource(url, {
headers: {
"Content-Type": "application/json",
Accept: "text/event-stream",
"X-SS-API-KEY": "",
"X-SSUID": "",
"X-SSPID": "",
Authorization:
bearer ${token}
,Connection: "keep-alive",
},
method: "POST",
body: JSON.stringify(data),
pollingInterval: 10000,
timeout: 10000,
});
es.addEventListener("message", e => {
console.log("message:", JSON.parse(e.data));
});
The text was updated successfully, but these errors were encountered: