Slide 22
Slide 22 text
Creating a gRPC server is fairly easy with all these concepts in mind. Define services
on a proto (just name, what comes in, and what goes out, implementation is on
whoever builds the server) and adequate data structures for messages (with the field
names, types, which can be many kinds of numbers, strings, enums, lists, and
substructures), its a nice and strict contract. Then compile that proto with 1 line in
terminal, and import the compiled proto in any program you want to use.
On the server side, create a generic gRPC server, and as many times as you want
you can with just one function bind a service (remember though, that you must
implement all the RPCs defined in each service).
On the client side, use “dial” to the service location (address and port), and create a
“client” structure with that connection (one method), and then you can start calling
RPC methods directly on the structure.
No need to do HTTP requests, because most of the low level details are abstracted,
content types (thats implicit in the proto structures), parsing or validating the structure
fields (proto structures are strict with the types so no need for that, maybe only
validate if its legal values, but thats on the logic, not the structure).
RPC TL;DR