Using gRPC with Go
Chris "Mac" McEniry
In the past few articles, we’ve used Go’s
net/rpc library to build a simple file metadata server. In this article, we’re going to look at using gRPC (https://grpc.io) to fulfill the same purpose.
gRPC has many advantages over the built-in RPC library, namely:
- Fast and efficient network communication
- Ability to stream inputs and outputs
- Automatic transport encryption
- Ability to interact with other languages
- Ready extensions to support authentication and connection handling.
gRPC is typically boiled down to the description “Protobuf messages over HTTP/2.” This is true to a first pass, but it also encompasses the libraries, middleware extensions, and interactions with other languages.
For the sake of brevity, some sections of the code examples here are left out. The full code for this example can be found at https://github.com/cmceniry/login-grpcls.