Maintaining wire compatibility
Under the hood, all client-server communication is issued across a multiplexed HTTP/2 connection (a channel in gRPC parlance). Messages are encoded using the protobuf wire format, and the particular service and method are extracted from headers sent along with the request.
In gRPC, calls are only distinguishable by their service and method names. For example, given the following protobuf, the target for a call would be practical_grpc.v1.SomeService/SomeMethod.
Protocol Buffer
syntax
=
"proto3"
;
package
practical_grpc
.
v1
;
service
SomeService
{
rpc
SomeMethod
(
SomeMethodRequest
)
returns
(
stream
SomeMethodResponse
);
}
...
Notice how the method’s request and response types are not included here. These, along with the cardinality of the method signature (unary vs streaming) are implicit in the call.
This means, at least in theory, that you could change a method from unary to streaming (by prepending a message with stream), or change the...