Skip to content
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

Fetch Streaming Body #9629

Closed
ambarc opened this issue Aug 29, 2016 · 7 comments
Closed

Fetch Streaming Body #9629

ambarc opened this issue Aug 29, 2016 · 7 comments

Comments

@ambarc
Copy link

@ambarc ambarc commented Aug 29, 2016

Question about RN's fetch API spec vs the Web Spec.

For reading a JSON stream through a browser - something like this works:

fetch(url).then(response => {
  const reader = response.body.getReader();
  const decoder = new TextDecoder();

  reader.read().then(function process(result) {
    if (result.done) return;
    const text = decoder.decode(result.value, {stream: true});
    console.log(text);
    return reader.read().then(process);
  }).then(() => {
    console.log('All done!');
  });
});

However, in RN - response.body returns as undefined. Is this missing in RN's fetch spec? Is there an alternative to consume the partial stream?

@ambarc

This comment has been minimized.

Copy link
Author

@ambarc ambarc commented Sep 1, 2016

@vjeux sorry to page. Does React Native's fetch implementation support streaming?

@charpeni

This comment has been minimized.

Copy link
Collaborator

@charpeni charpeni commented Nov 14, 2016

@facebook-github-bot label Icebox

@charpeni

This comment has been minimized.

Copy link
Collaborator

@charpeni charpeni commented Nov 14, 2016

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/fetch-streaming-body

ProductPains helps the community prioritize the most important issues thanks to its voting feature.
It is easy to use - just login with GitHub.

Also, if this issue is a bug, please consider sending a PR with a fix.
We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.

@charpeni

This comment has been minimized.

Copy link
Collaborator

@charpeni charpeni commented Nov 14, 2016

@facebook-github-bot

This comment has been minimized.

Copy link

@facebook-github-bot facebook-github-bot commented Nov 14, 2016

@charpeni tells me to close this issue. If you think it should still be opened let us know why.

@yuyao110120

This comment has been minimized.

Copy link

@yuyao110120 yuyao110120 commented Jan 18, 2018

This question resolved or have a plan now? Steam feature is good for download file process.

@ambarc

This comment has been minimized.

Copy link
Author

@ambarc ambarc commented Jan 18, 2018

ended up using websockets.

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants
You can’t perform that action at this time.