Greg, a gRPC-web tutorial is in the works here https://github.com/grpc/grpc.github.io/pull/737. If you are interested please give your feedback in the PR.
On Thursday, September 20, 2018 at 1:53:06 PM UTC-7, Spencer Fang wrote: > > Yes envoy proxy is an example of a supported proxy. gRPC on the web > browser uses the grpc-web protocol, which is different from the regular > grpc protocol. Here's an example of a config that makes envoy perform this > translation: > https://github.com/grpc/grpc-experiments/blob/master/grpc-zpages/docker/envoy/zprox.sh > > > > On Thu, Sep 20, 2018 at 9:27 AM Greg Keys <gk...@mumbacloud.com > <javascript:>> wrote: > >> By proxy do you mean something like Envoy? I'm not opposed to using >> something like that, it's basically serves the same purpose of the router >> that I'm used to using from crossbar, so I'm able to reason about that >> fairly easily. >> >> I'm also happy to hear the http/2 works with tls, everything we do is >> tls. so that should be fine, so long as it will multiplex over a single tcp >> connection. the whole reason we're looking to move away from crossbar and >> websockets is the scaling issue. >> We are currently dependent on the crossbar router which does not cluster >> or scale making it a single point of failure for us, but envoy appears to >> have scaling working quite nicely. >> >> I supposed what makes grpc-web so hard to reason about at the moment is >> the documentation, it's not very clear, the documentation lays out a simple >> Echo, EchoRequest, EchoResponse proto but in the actual code they implement >> about 20 other methods, addLeft, addRight etc..... so my mind immediately >> goes wtf. >> >> I guess I'll spend a little more time sorting through the code and try to >> come up with something simpler to digest, grpc-web examples are definitely >> lacking right now. >> >> On Wednesday, September 19, 2018 at 6:15:54 PM UTC-7, Carl Mastrangelo >> wrote: >>> >>> There are examples how to run in a browser, but they typically involve a >>> sidecar proxy. Here is one example: >>> https://github.com/grpc/grpc-experiments/tree/master/grpc-zpages The >>> full docs are here: https://github.com/grpc/grpc-web >>> >>> Browsers present two challenges to gRPC. First, they only use HTTP/2 >>> when using TLS or SSL, which a lot of websites don't. Second, Browsers >>> don't expose the HTTP trailers that are needed to tell when the response is >>> done. To get around these issues, we have gRPC-Web protocol, which >>> modifies the gRPC protocol slightly to be usable on HTTP/1.1. The fetch() >>> API for Browsers was supposed to fix the latter problem, but it has not >>> been implemented by them, so we are kinda stuck with the work around until >>> they do. >>> >>> Lastly, browsers use CORS when making RPCs across origin, which happens >>> when you serve your RPCs from a different port than you HTML. This may >>> affect you depending on your setup. >>> >>> >>> I guess all of this is to say that getting requests (or RPCs) to work in >>> the browser is much more complicated that it first appears, and >>> unfortunately we can't fix it for you. The proxy solution, while more >>> complex, does solve a number of things you would have to otherwise do. >>> >>> >>> >>> >>> >>> On Wednesday, September 19, 2018 at 4:26:57 PM UTC-7, Greg Keys wrote: >>>> >>>> I was thrilled when I started looking at gRPC as an alternative to our >>>> current implementation of websockets (crossbar.io) however that >>>> enthusiasm is dwindling the more I look into it. >>>> >>>> Am I understanding this correctly that it's primary strength is server >>>> side service to service communication? >>>> >>>> My hope was to use it in the browser as well as service to service. But >>>> from what I gather the browser implementation is still using http/1.1 and >>>> it does not multiplex as a result and instead uses xhr >>>> >>>> I have not been able to find any good (simple) examples of gRPC in the >>>> browser, I've found a couple but they are really complex to reason about, >>>> compared to the server side examples which are >>>> typically really simple. >>>> >>>> Are there any good examples of gRPC in the browser? are there any >>>> implementations in the browser that multiplex? >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "grpc.io" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to grpc-io+u...@googlegroups.com <javascript:>. >> To post to this group, send email to grp...@googlegroups.com >> <javascript:>. >> Visit this group at https://groups.google.com/group/grpc-io. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/grpc-io/e31b7f17-70e8-4a53-bec4-055eca05c9d9%40googlegroups.com >> >> <https://groups.google.com/d/msgid/grpc-io/e31b7f17-70e8-4a53-bec4-055eca05c9d9%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > Spencer Fang > > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To post to this group, send email to grpc-io@googlegroups.com. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/5a389596-56bd-4c77-9e93-016ec94b0386%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.