Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using an alternative connection channel/transport for GRPC

Tags:

windows

rpc

grpc

I currently have a primitive RPC setup relying on JSON transferred over secured sockets, but I would like to switch to gRPC. Unfortunately I also need access to AF_UNIX on windows (Which Microsoft recently started supporting, but gRPC has not implemented).

Since I have an existing working connection (managed with a different library), my preference would be to just use that in conjunction with GRPC to send/receive commands in place of my JSON parsing, but I am struggling to identify the best way to do that.

I have seen Plugging custom transport into gRPC but this question differs in the following ways (As well as my hope for a more recent answer)

  1. I am wanting to avoid making changes to the core of gRPC. I'd prefer to extend it if possible from within my library, but the answer here implies adding a new transport to gRPC.If I did need to do this at the transport level, is there a mechanism to register it with gRPC after the core has been built?
  2. I am unsure if I need to define this as a full custom transport, since I do already have an existing connection established and ready. I have seen some things that imply I could simply extend Channel, but I might be wrong.
  3. I need to be able to support Windows, or at least modern versions of it (Which means that the from_fd options gRPC provides are not available since they are currently only implemented for POSIX)

Has anyone solved similar problems with gRPC?

like image 679
user2180076 Avatar asked Nov 26 '25 11:11

user2180076


1 Answers

I may have figured out my own answer. I seem to have been overly focused on gRPC, when the service definition component of Protobuf is not dependent on that.

How can i write my own RPC Implementation for Protocol Buffers utilizing ZeroMQ is very similar to my use case, with https://developers.google.com/protocol-buffers/docs/proto#services seeming to resolve my issue (And this also explains why I seem to have been mixing up the different kinds of "Channels" involved

I welcome any improvements/suggestions, and hope that maybe this can be found in future searches by people that had the same confusion.

like image 101
user2180076 Avatar answered Dec 01 '25 20:12

user2180076