In gRPC you can define a method like
service HelloService {
rpc SayHello (HelloRequest) returns (HelloResponse);
}
or
service HelloService {
rpc SayHello (HelloRequest) returns (HelloResponse) {}
}
(from http://www.grpc.io/docs/guides/concepts.html#service-definition).
I've looked through the docs and there doesn't seem to be anything you can put inside the brackets. So, given that I can terminate the definition with ;
what are that brackets for?
repeated : this field can be repeated any number of times (including zero) in a well-formed message. The order of the repeated values will be preserved.
Google Remote Procedure Call, more commonly known as gRPC, is a remote procedure call (RPC) framework that brings performance benefits and modern features to client-server applications. Like RPC, it allows you to directly call methods on other machines.
By default, gRPC uses Protocol Buffers, Google's mature open source mechanism for serializing structured data (although it can be used with other data formats such as JSON).
A gRPC channel provides a connection to a gRPC server on a specified host and port. It is used when creating a client stub. Clients can specify channel arguments to modify gRPC's default behavior, such as switching message compression on or off. A channel has state, including connected and idle .
I'm not an expert but I will try to explain it
You can add custom options in your rpc definitions
For example if you use grpc-gateway that allows you to translate the RESTful API into gRPC
In this snippet I'm requesting the body
field and the RESTful call will be in /api/{client}
for example:
service Builder {
rpc Generate(Request) returns (Response) {
option (google.api.http) = {
post: "/api/{Client}"
body: "*"
};
}
}
You can see full reference here cloud.google.com/service-management/reference
Note: I took the reference link from the grpc-gateway repo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With