How to import and indicate empty request or reply messages:
import "google/protobuf/empty.proto";
service SomeService {
rpc SomeOperation (google.protobuf.Empty) returns (google.protobuf.Empty) {}
}
How to import and indicate empty request or reply messages:
import "google/protobuf/empty.proto";
service SomeService {
rpc SomeOperation (google.protobuf.Empty) returns (google.protobuf.Empty) {}
}
Assuming we're talking about gRPC, there's still data sent over the wire.
The response body has a five-byte prefix, which should be all zeros: the first byte indicates whether the message is compressed, and the next four bytes are a 32-bit unsigned integer. Empty protobuf messages serialize to zero bytes, and
google.protobuf.Empty
is always empty, so there's no data following the initial 5 bytes.You'll also end up sending at least one trailer with the status code (
grpc-status: 0
). Depending on your implementation, you may also send thegrpc-message
andgrpc-status-details-bin
trailers.