Protocol Buffers and .proto Files
Message types, services, and protoc codegen
What are Protocol Buffers?
Protocol Buffers (protobuf) is a language-neutral, binary serialization format developed by Google. It is smaller and faster than JSON and is the canonical wire format for gRPC.
.proto file syntax
Define messages and services in a .proto file:
syntax = "proto3";
package user;
option go_package = "github.com/example/user/pb";
message User {
int64 id = 1;
string name = 2;
string email = 3;
}
service UserService {
rpc GetUser (GetUserRequest) returns (User);
}
message GetUserRequest { int64 id = 1; }All lessons in this course
- Protocol Buffers and .proto Files
- Implementing a Unary gRPC Service
- Server and Client Streaming
- gRPC Interceptors and Metadata