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

Support ReadableStreams in services::fetch #1207

Closed
nicklaswj opened this issue May 11, 2020 · 11 comments
Closed

Support ReadableStreams in services::fetch #1207

nicklaswj opened this issue May 11, 2020 · 11 comments
Labels
feature-request A feature request

Comments

@nicklaswj
Copy link
Contributor

Currently services::fetch:: does not support ReadableStreams, which would allow the user to read the body in byte chunks. However web-sys does currently not really support ReadableStreams (see rustwasm/wasm-bindgen#1761), so in the meantime we will have to make a solution that uses handwritten bindings.

I'm still not exactly sure what the best yew API would look like, so any suggestions are very welcome 😄

I have no code to show yet - but I'll link to it when I do.

@nicklaswj nicklaswj added the feature-request A feature request label May 11, 2020
@teymour-aldridge
Copy link
Contributor

One possible way to solve this is to raise an issue in the web-sys repo?

@nicklaswj
Copy link
Contributor Author

One possible way to solve this is to raise an issue in the web-sys repo?

From the comments in the linked PR, it seems like web-sys is blocked by that the Streams spec doesn't currently use WebIDL. But I agree it would be best if we could find a solution with the web-sys team

@teymour-aldridge
Copy link
Contributor

I feel like this is something that the Rust Wasm Working Group might be better placed to address, but we could try and put something together to work as an intermediary solution.

@nicklaswj
Copy link
Contributor Author

nicklaswj commented May 11, 2020

Yep I agree and that is also my idea.
So this solution should expose a yew API that's backed by some kind of intermediary solution, and then later be swapped out with a more permanent solution (preferably without changing the yew API).

@nicklaswj
Copy link
Contributor Author

nicklaswj commented May 11, 2020

And if we hand write the js bindings 1-to-1, it probably wont be hard to shift to whatever Wasm Working Group comes up with.

edit: I hope

@nicklaswj
Copy link
Contributor Author

WIP branch https://github.com/nicklaswj/yew/tree/readablestreams nothing works yet though

@teymour-aldridge
Copy link
Contributor

Looks cool.

@MattiasBuelens
Copy link

I noticed this issue was linked to rustwasm/wasm-bindgen#1761, and I see you've started building your own wrappers to work with JavaScript ReadableStreams in Rust.

If you're interested: I've just published a crate which provides such wrappers, and supports converting from and into Rust Streams. Perhaps it could help simplify your implementation? 🙂

If you're not interested, that's fine too. (I hope I didn't disturb your conversation too much...)

@nicklaswj
Copy link
Contributor Author

I noticed this issue was linked to rustwasm/wasm-bindgen#1761, and I see you've started building your own wrappers to work with JavaScript ReadableStreams in Rust.

If you're interested: I've just published a crate which provides such wrappers, and supports converting from and into Rust Streams. Perhaps it could help simplify your implementation? slightly_smiling_face

If you're not interested, that's fine too. (I hope I didn't disturb your conversation too much...)

Oh nice thanks for the heads up. I'll take a look :D

@nicklaswj
Copy link
Contributor Author

@MattiasBuelens It really looks good!

@mc1098
Copy link
Contributor

mc1098 commented Jul 29, 2021

I think this can now be closed as the fetch service has been removed in #1842

@siku2 siku2 closed this as completed Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature request
Projects
None yet
Development

No branches or pull requests

5 participants