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 gRPC-Web protocol #43

Open
jakobr-google opened this Issue Dec 20, 2017 · 43 comments

Comments

Projects
None yet
@jakobr-google
Copy link
Contributor

jakobr-google commented Dec 20, 2017

See the gRPC-Web protocol document for details.

We should be able to support this by making a GrpcWebChannel that implements the ClientChannel interface.

@gedw99

This comment has been minimized.

Copy link

gedw99 commented Feb 13, 2018

Last time I looked at this package I was informed that it's designed for flutter.
But if scope has now expanded to support http 2 and http 1.1 then the improbable grpc-web library should be looked at. It's much easier and imho more useful than the official grpc-web that uses c++ and nginx. Anyway..

I don't use dart on the server, but instead golang.
But if you want to support http 1.1 with grpc dart go have a look.

I use http 1.1 and a VPN entire provide security where I can't tolerate domains. For example in on premise projects and where the endpoint on both ends is a dynamic IP. In those cases a private dht is used as a closed DNS to match up addresses up to organisations.
Why am I waiting on about this ? Well Https is great and we all want security but for b2b and iot and p2p http2 is a blocker.

@gedw99

This comment has been minimized.

Copy link

gedw99 commented Mar 3, 2018

See the improbable git repo for a grpc-web implementation that support normal grpc and grpc with browsers using websockets to give bi-directional streaming.
This version also adheres to the spec.
It also has great interceptor integration for logging, tracing and metric using Prometheus and is heavily production battle tested as they say.

It's golang, not dart based but much easier and flexible than the nginx and cpp way.

@jakobr-google

This comment has been minimized.

Copy link
Contributor Author

jakobr-google commented Mar 6, 2018

No-one is talking about nginx or c++ here. This issue is for implementing the gRPC-Web protocol in Dart.

@gedw99

This comment has been minimized.

Copy link

gedw99 commented Mar 6, 2018

did not know :)

sounds good...

@sgon00

This comment has been minimized.

Copy link

sgon00 commented Mar 16, 2018

Hi, any updates and plans on this requirement?

I plan to use grpc/http2 only (displacement of old http1 REST and websockets) in a new flutter project. For web interface, I plan to try angulardart v5 because it uses the same dart language. But after some research, I found out there were no native dart grpc-web support.

So far, I found out:

To workaround it, I may try to use js_facade_gen tool to generate Dart code for the improbable typescript client. I am not sure if this will work or not.
I hope angulardart can have its own native gRPC-Web protocol support soon. Thanks a lot.

@jakobr-google

This comment has been minimized.

Copy link
Contributor Author

jakobr-google commented Mar 16, 2018

Sounds like there's a lot of interest for this, so I've moved it up on my list of priorities. Absolutely no guarantees, but I expect to start looking at it around end of next week.

In the meantime, if anyone wants to pitch in, I'll happily take PRs for this!

@sgon00

This comment has been minimized.

Copy link

sgon00 commented Mar 16, 2018

@jakobr-google Thank you very much for your quick reply and hard work. 👍

@gedw99

This comment has been minimized.

Copy link

gedw99 commented Mar 16, 2018

@jakobr-google

This comment has been minimized.

Copy link
Contributor Author

jakobr-google commented Mar 16, 2018

Just to make sure we're on the same page: Flutter is already supported. This issue is for adding support for web browsers, too.

@gedw99

This comment has been minimized.

Copy link

gedw99 commented Mar 16, 2018

@pcariel

This comment has been minimized.

Copy link

pcariel commented Mar 20, 2018

@jakobr-google this improvement will be compatible with Google Cloud Platform Endpoints ?

@jakobr-google

This comment has been minimized.

Copy link
Contributor Author

jakobr-google commented Mar 22, 2018

@pcariel from what I can tell, for Cloud Endpoints, you configure a REST/JSON mapping that you can use from the browser, instead of talking gRPC. It doesn't look like they support gRPC-Web, AFAICT, so fixing this issue won't help with that, unfortunately.

For those following this issue, please keep in mind that

  1. The gRPC protocol is based on HTTP/2, and as such does not currently work in browsers, since they don't expose HTTP/2 semantics.
  2. The gRPC-Web protocol is not the same as gRPC. It requires you to run a proxy that will accept the gRPC-Web protocol calls from the browser, and translate them into real gRPC calls to the server. This gRPC-Web proxy will need to run somewhere (preferably on the same domain as the web app, so you don't have to deal with CORS). If you're really lucky, the gRPC server you're talking to might support gRPC-Web natively, in addition to gRPC.

This issue tracks adding support for a gRPC-Web client channel, as well as server support for gRPC-Web.

@leocavalcante

This comment has been minimized.

Copy link

leocavalcante commented Mar 23, 2018

I want to live in a world where your gRPC Dart server could serve your Flutter app and your AngularDart web-app without any hassle.

@kevmoo

This comment has been minimized.

Copy link
Contributor

kevmoo commented Mar 23, 2018

@adrianmercieca

This comment has been minimized.

Copy link

adrianmercieca commented Mar 24, 2018

Hi,

I'm really excited by all this; it would be great to also have Dart Web support for gRPC. We could then write all our back-end services using gRPC (using any supported implementation language) and access it from clients built using Dart from both Flutter and Dart web.

Really this becomes a reality; watching this space...

@Brahmasmi

This comment has been minimized.

Copy link

Brahmasmi commented Mar 28, 2018

Am I correct in my understanding that the planned gRPC-Web client channel functionality will work with AngularDart on the browser?

I ask this because I am in actual need of the gRPC-Web client channel functionality for an AngularDart web app, and was leaning towards @improbable-eng's Typescript based gRPC-Web.

As the previous posters have alluded to, adding gRPC-Web client channel natively to Dart would essentially nearly complete the common communication stack. It would nicely complement @improbable-eng's Go proxy.

I look forward to this functionality.

@adrianmercieca

This comment has been minimized.

Copy link

adrianmercieca commented Mar 29, 2018

I second this; really look forward to have gRPC accessible from the browser via Dart.

@HeNKiEeEeE

This comment has been minimized.

Copy link

HeNKiEeEeE commented Jun 2, 2018

I also wanted to use GRPC in my angulardart app, to communicate with a remote service. As I understand from here its not possible yet?

@Kleak

This comment has been minimized.

Copy link

Kleak commented Jun 2, 2018

Yes it's not possible yet

@leocavalcante

This comment has been minimized.

Copy link

leocavalcante commented Jun 2, 2018

@HeNKiEeEeE it is not trivially possible yet, but you still can run your gRPC server behind a gRPC-Web enabled proxy like Nginx, Envoy or gRPC Web Proxy from Improbable and rely on Dart's JS interop on the client.

@JCzz

This comment has been minimized.

Copy link

JCzz commented Jun 5, 2018

Do we know if this is being worked on and if so, super cool - and when to expect?

@wav

This comment has been minimized.

Copy link

wav commented Jun 6, 2018

I have an initial attempt here wav/grpc-web-dart at a client over HTTP/1.1. It does basic RPC against a golang server. It's used in a flutter app to get through a firewall.

The part that calls the HttpClient would need to switch to XHR if in the browser here:

https://github.com/wav/grpc-web-dart/blob/717187ebfacdbf3f221e6cf39948ac265e69592e/lib/src/call.dart#L57

It's just a simple request and response once you parse the protocol message data.

I may continue it when I get a bit more time.

@frankbenoit

This comment has been minimized.

Copy link

frankbenoit commented Jun 15, 2018

Having a full implementation is for me the missing component to give dart and angulardart a trial in my company.

@gedw99

This comment has been minimized.

Copy link

gedw99 commented Jun 20, 2018

@wav why did you say "to get through a firewall" ? normal grpc uses port 443 ( if secure). Would that not also get through a firewall . Just want to understand and learn....

@wav

This comment has been minimized.

Copy link

wav commented Jun 21, 2018

Currently I'm working in a MS environment.

I took the approach of using HTTP/1.1 as a "non deep investigative" approach to getting the app through a few environments where I cannot use HTTP/2.

In this case it's a "perimeter" firewall/proxy/...? serving several sites on the same port inside a company network. The certificate is configured there. It appears to do packet inspection and doesn't seem to like HTTP/2 (it proxies many websites on the same port). I haven't worked out why.

If I try open an HTTP/2 TLS connection it doesn't work either. Again, I haven't worked out why. Other golang apps are fine.

Also, if I want to put it behind IIS or run it in an App Service in Azure only HTTP/1.1 traffic seems to get through. In this environment, I also don't use a TLS connection as it's handled by the "perimeter".

@zoechi zoechi referenced this issue Jun 22, 2018

Closed

gRPC #22655

@gedw99

This comment has been minimized.

Copy link

gedw99 commented Jul 30, 2018

Any updayrs on this ?

@kevmoo

This comment has been minimized.

Copy link
Contributor

kevmoo commented Jul 31, 2018

@gedw99 – nope. If a community member wanted to make a go at it, we'd love to discuss.

@Brahmasmi

This comment has been minimized.

Copy link

Brahmasmi commented Aug 1, 2018

In light of @kevmoo's helpful comment above, I have opened an issue with the gRPC web team [1] requesting support for Dart / AngularDart. I would request all volks who wish to see gRPC-web support to please share your thoughts on that issue.

Thanks.

[1] - grpc/grpc-web#213

@fuzzybinary

This comment has been minimized.

Copy link
Contributor

fuzzybinary commented Aug 2, 2018

Hey @kevmoo / @jakobr-google

Looking through the code, it looks like ClientChannel is fairly simple at the moment, but it looks like it could expand to do multiple connections / load balancing -- does it make sense to setup ClientConnection as an abstract class / interface and either provide a factory method to ClientChannel or have it decide based off environment which type of connection to create?

If so that could be a simple first step towards getting gRPC-Web capabilities.

@Brahmasmi

This comment has been minimized.

Copy link

Brahmasmi commented Aug 20, 2018

@fuzzybinary I am not sure whether @jakobr-google is still with Google. Based on my limited understanding, I think Jakob may have moved on from Google [1]. If I am not wrong, Jakob was looking after HTTP/2, Protobuf as well as gRPC for Dart.

[1] - https://dk.linkedin.com/in/jakobroland

@fuzzybinary

This comment has been minimized.

Copy link
Contributor

fuzzybinary commented Aug 20, 2018

Sure does look like that! Hopefully this will get picked back up as a priority at some point. It appears @sigurdm has access to merge pull requests - hopefully at some point someone will be able to look over my PR and give feedback.

I can be patient until then though.

@keertip

This comment has been minimized.

Copy link

keertip commented Aug 20, 2018

@mit-mit

This comment has been minimized.

Copy link
Collaborator

mit-mit commented Aug 23, 2018

@sigurdm has taken over from @jakobr-google

@mit-mit

This comment has been minimized.

Copy link
Collaborator

mit-mit commented Aug 23, 2018

Some work for this is happening over in #109

@facundomedica

This comment has been minimized.

Copy link

facundomedica commented Sep 26, 2018

Any updates on this?

@fuzzybinary

This comment has been minimized.

Copy link
Contributor

fuzzybinary commented Sep 27, 2018

I think the initial PR is ready for review, but the unit tests are failing (but not sure why). @sigurdm can you take a look?

@fuzzybinary

This comment has been minimized.

Copy link
Contributor

fuzzybinary commented Oct 2, 2018

Got around to fixing the unit tests for this, so now I think just looking for some comments on the PR to see if it can be pulled in.

@mit-mit

This comment has been minimized.

Copy link
Collaborator

mit-mit commented Oct 3, 2018

@sigurdm is out this week, but hoping he can look next week

@JCzz

This comment has been minimized.

Copy link

JCzz commented Oct 21, 2018

Very nice!
How do we get this, if it is out?

Update: Maybe this and if, it looks close to something: #109

@frankbenoit

This comment has been minimized.

Copy link

frankbenoit commented Nov 17, 2018

I check this issue each week, currently a bit worried as it is silent since some time. Please give it a push, this is a big thing IMO.
This feature opens browser application a properly typed API to the backend. A real "now i want to try Dart" argument.

@glenfordwilliams

This comment has been minimized.

Copy link

glenfordwilliams commented Nov 17, 2018

same here along with the pull request for proper json interop

@SpikingNeurons

This comment has been minimized.

Copy link

SpikingNeurons commented Nov 18, 2018

I want grpc backend built with python and access it with frontend designed with AngularDart. I suppose that grpc-web needs to be supported for AngularDart. This issue seems to get grpc-web support for grpc-dart. Sorry for being naive at this, but please help me understand, am I missing something.

In case I am looking at wrong place please help me understand how I can get AngularDart base web frontend access grpc backend designed in python.

@wstrange

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.