Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to parse HTTP message from another node to a gRPC server

I could successfully run a gRPC client and gRPC server in c++ now I wish to establish a communication between node A and gRPC server i.e. node B as in the attached image.

Are there any examples which I can refer to below is what I am looking for.

I have this node A with http message (GET method) which I need to parse i.e extract the message and run the request on node C. What is that I should look for in between Node A and gRPC server.

Thanks in Advance

http message to gRPC server

like image 591
Vinay Shukla Avatar asked Apr 16 '18 08:04

Vinay Shukla


People also ask

Does gRPC work over HTTP?

gRPC benefits gRPC uses HTTP/2 under the covers, but gRPC does not expose any of HTTP/2 to the API designer or API user. gRPC has already made all the decisions on how to layer the RPC model on top of HTTP so you don't have to—those decisions are built into the gRPC software and generated code.

Can gRPC server handle multiple clients?

Multiple gRPC clients can be created from a channel, including different types of clients. A channel and clients created from the channel can safely be used by multiple threads. Clients created from the channel can make multiple simultaneous calls.

Can gRPC server call client?

gRPC users typically call these APIs on the client side and implement the corresponding API on the server side. On the server side, the server implements the methods declared by the service and runs a gRPC server to handle client calls.


1 Answers

Most of the times, if you have to use HTTP to contact a gRPC node, it most likely means that A is in fact a browser or browser-like environment, since you can simply instantiate a gRPC client on pretty much anything else.

If that's your situation, then I'd suggest having a look at grpc-web which aims to address that specific situation.

like image 90
Frank Avatar answered Oct 06 '22 01:10

Frank