2 Nov 2026
gRPC stuff (WIP)
In gRPC, a client application can directly call a method on a server application on a different machine as if it were a local object, making it easier for you to create distributed applications and services.
imo, gRPC, basically, is a convenience layer. If you write a server and a client, then the server will do the necessary work of interpreting your request (from whatever language) and returning your data (in whatever language) back to yourself. This makes it easier to think of all your API calls as returning simple runtime objects.
The client has a bunch of methods it can call that "binds" to the gRPC server.
Protocol Buffers
in your .proto file you define a protocol buffer. the protocol buffer is language agnostic, but allows you to generate the class you need in the language you desire. Here's a .proto file you can use.
service HelloService {
rpc SayHello (HelloRequest) returns (HelloResponse);
}
message HelloRequest {
string greeting = 1;
}
message HelloResponse {
string reply = 1;
}
gRPC methods
//unary
rpc SayHello(HelloRequest) returns (HelloResponse); //like a normal function
//server streaming
rpc LotsOfReplies(HelloRequest) returns (stream HelloResponse);
//uses TCP and HTTP/2. Yes. The multiplexing thing from the HTTPs article. Yes they stream.
//With HTTP/2
//This is like subscribing to stock updates or whatever
//client streaming
rpc LotsOfGreetings(stream HelloRequest) return (HelloResponse);
// now this means that we stream to the server (visible through input type)
// then the server returns a single message.
// see the keyword structure
//bidirectional. now they're both streams
rpc BidiHello(stream HelloRequest) returns (stream HelloResponse);
RPC procedures
First consider the simplest type of RPC where the client sends a single request and gets back a single response.
- Once the client calls a stub method, the server is notified that the RPC has been invoked with the client’s metadata for this call, the method name, and the specified deadline if applicable.
- The server can then either send back its own initial metadata (which must be sent before any response) straight away, or wait for the client’s request message. Which happens first, is application-specific.
- Once the server has the client’s request message, it does whatever work is necessary to create and populate a response. The response is then returned (if successful) to the client together with status details (status code and optional status message) and optional trailing metadata.
- If the response status is OK, then the client gets the response, which completes the call on the client side
For server streaming, response terminates when you get the request status code.
Client streaming is just like the first case because the server still responds with a single messages with the status and the body or whatever.
Bidirectional has the most flexibility
Other stuff
Channel configurations that help with message compression.
RPC can fail on either the server or client side. No i refuse to elaborate. Ok fine. It can fail for the client in the sense that the server can fail to send before the deadline or fail in the sense that the server sent before the client was done with its response package.