3
votes

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

4
Can you elaborate on the question ? I thought the docs were pretty straightforward. Maybe you have not used rpc before ?Romain Hippeau
@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
stackoverflow.com/questions/35065875/… 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

4 Answers

6
votes

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

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

4
votes

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.

2
votes

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