grpc-dart
grpc-dart copied to clipboard
Implement fetch based transport
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.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: jbrownsw / name: Steve Browne (26b5dbb8dbbaccea04bca7cc866a4035a1b503d3, da178b3aff1e268f0fb68abc51165853b92524de, e627db5cb6d41a4c2dfb16c12e5e93b12d14ac7a, 32ad527340875b616f3a5858b292ba8ec5f9e4fc, 20dfb827646a671091d33468a25f0a3ed408163c)
I created an issue for the dart SDK with my last change (5a8818b): https://github.com/dart-lang/sdk/issues/49399
Hi @jbrownsw, do you think webfetch could help resolve the issue?
@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 :)
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.