Protocol Buffer Services: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=Internal= Protocol Buffers can define services that use messages to exchange data. A '''service''' is a set of '''endpoints''', introduced by the <code>rpc</code> keyword, with different semantics that can be used to call into the service, by sending a request, and then receiving a response. <syntaxhighlight lang='protobuf'> service SomeService { rpc SomeEndpoint(SomeRequest) returns (SomeResponse); rpc SomeOtherEndpoint(SomeOtherRequest) returns (So...") |
|||
Line 1: | Line 1: | ||
=Internal= | =Internal= | ||
* [[Protocol_Buffer_Concepts#Services|Protocol Buffer Concepts]] | |||
=Overview= | |||
Protocol Buffers can define services that use [[#Message|messages]] to exchange data. | Protocol Buffers can define services that use [[#Message|messages]] to exchange data. | ||
Line 33: | Line 36: | ||
{{Internal|GRPC_Concepts#gRPC_and_Protocol_Buffer_Services|gRPC and Protocol Buffer Services}} | {{Internal|GRPC_Concepts#gRPC_and_Protocol_Buffer_Services|gRPC and Protocol Buffer Services}} | ||
=Example= |
Revision as of 01:55, 11 May 2024
Internal
Overview
Protocol Buffers can define services that use messages to exchange data.
A service is a set of endpoints, introduced by the rpc
keyword, with different semantics that can be used to call into the service, by sending a request, and then receiving a response.
service SomeService {
rpc SomeEndpoint(SomeRequest) returns (SomeResponse);
rpc SomeOtherEndpoint(SomeOtherRequest) returns (SomeOtherResponse);
}
message SomeRequest {
...
}
message SomeResponse {
...
}
message SomeOtherRequest {
...
}
message SomeOtherResponse {
...
}
This is how you define an API.
The service and the client code is generated by a framework, and the preferred one is gRPC.