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

Implement fetch based transport #549

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

jbrownsw
Copy link

@jbrownsw jbrownsw commented May 4, 2022

This is essentially to resolve issue #511. It's designed to be very similar to the existing xhr transport, but with my own FetchHttpRequest to replace the HttpRequest type. I was a little lazy on the events so they differ a bit, but I could change them to match those used by xhr to make them even more similar. I could also remove some of the code duplication and the transport stream and connection could be shared with only FetchHttpRequest or HttpRequest being the difference and that could be passed in as a function or a generic type parameter. Finally the last thing I wasn't sure of is if you would want this as a complete replacement for xhr or if you'd rather them coexist so people can switch between them etc. So web_channel.dart will need to be updated based on what route you want to go there.

I'm already using this as a drop in replacement for our app and haven't noticed any differences other than the memory growth for streams disappearing.

Steve Browne added 5 commits April 30, 2022 20:51
…s a Uint8Array to support values larger than 127 which string encoding was messing up.
…aborted so that we stop reading gracefully.
…h some minor changes because of the events. Also made some minor tweaks to fetch to have a String response for the tests like xhr.
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 4, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

Steve Browne added 5 commits May 5, 2022 09:31
…ut not with 2.16 which is what I was using during development.
…an iterable type. This apparently changed with flutter 3.0.
…namic javascript types because the resulting code does not work when building web in release mode.
@jbrownsw
Copy link
Author

jbrownsw commented Jul 5, 2022

I created an issue for the dart SDK with my last change (5a8818b):
dart-lang/sdk#49399

@listepo
Copy link
Contributor

listepo commented Jan 5, 2024

Hi @jbrownsw, do you think webfetch could help resolve the issue?

@matt-deboer
Copy link

matt-deboer commented Apr 26, 2024

@jbrownsw I just tested this branch today (had to add one no-op implementation for the updated main branch) and it seems to work well in debug and release mode. Perhaps your original issues have been since resolved? Or maybe I'm not hitting the repro condition?

For me, it makes my jpeg video stream actually usable in grpc-web, so would love to see it merged :)

@jbrownsw
Copy link
Author

I don't work at the company that I developed this for so I can't test it, but perhaps @gawmanarnar can get someone to confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants