3

I have a c++ service which I intend to expose using a gRPC server. What is the way a web browser would communicate with the gRPC server? I am using angularJS for the front end.

I look at grpc documentation. But can't find information on browser support.

Image taken from https://dzone.com/articles/grpc-sample-in-c-and-python

ravindrab
  • 2,712
  • 5
  • 27
  • 37
  • Can you elaborate on the question ? I thought the docs were pretty straightforward. Maybe you have not used rpc before ? – Romain Hippeau Jun 03 '16 at 20:13
  • @RomainHippeau I updated the question. Yes, I haven't used gRPC before. I updated the question. In short, how can communicate to a gRPC server from web browser? – ravindrab Jun 03 '16 at 20:49
  • http://stackoverflow.com/questions/35065875/how-to-bring-a-grpc-defined-api-to-the-web-browser http://www.grpc.io/faq/ it looks like you are going to need a translation service. If not get supports object serialization and rpc. It is a steep learning curve. – Romain Hippeau Jun 04 '16 at 13:41
  • Possible duplicate of [How to bring a gRPC defined API to the web browser](https://stackoverflow.com/questions/35065875/how-to-bring-a-grpc-defined-api-to-the-web-browser) – Gabriel Grant Jul 25 '17 at 23:55

4 Answers4

6

i used grpc gateway. Many large projects use it too. It translated GRPC RPC into Rest / JSON.

https://github.com/gengo/grpc-gateway

4

How to bring a gRPC defined API to the web browser http://www.grpc.io/faq/ it looks like you are going to need a translation service. If not gwt supports object serialization and rpc. It is a steep learning curve.

Community
  • 1
  • 1
Romain Hippeau
  • 24,113
  • 5
  • 60
  • 79
2

With some more recently released technology (and also one of the answers on the question that is a possible duplicate): I've used the grpcwebproxy (on top of a Python grpc server) and the corresponding ts-protoc-gen plugin from Improbable. It "talks" gRPC directly between client / server (following the preliminary web-spec), without using REST or JSON translation, and allows you to use your proto files client-side as well as server-side:

https://improbable.io/games/blog/grpc-web-moving-past-restjson-towards-type-safe-web-apis

https://github.com/improbable-eng/grpc-web

user
  • 4,651
  • 5
  • 32
  • 60
1

Now gRPC web is available to use.

https://github.com/grpc/grpc-web

Abhishek Singh
  • 1,631
  • 1
  • 17
  • 31