← All notes

gRPC services are defined in .proto files with four kinds of RPC methods

Answer: Define a service in a .proto file, specifying the methods that can be called remotely with their parameters and return types. Protocol buffers are the default Interface Definition Language (IDL) for the service interface and the payload messages.

Example

service HelloService {
  rpc SayHello (HelloRequest) returns (HelloResponse);
  rpc LotsOfReplies (HelloRequest) returns (stream HelloResponse);
  rpc LotsOfGreetings (stream HelloRequest) returns (HelloResponse);
  rpc BidiHello (stream HelloRequest) returns (stream HelloResponse);
}

message HelloRequest { string greeting = 1; }
message HelloResponse { string reply = 1; }

The four kinds of method

| Kind | Messages | |---|---| | Unary | the client sends a single request and gets a single response back, just like a normal function call | | Server streaming | the client sends a request and reads a stream of messages back until there are no more | | Client streaming | the client writes a sequence of messages, then waits for the server's single response | | Bidirectional streaming | both sides send a sequence of messages using a read-write stream |

gRPC guarantees message ordering within an individual RPC call. In bidirectional streaming the two streams operate independently, and either side may read and write in whatever order it likes.

Lifecycle rules

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: gRPC docs, Core concepts, architecture and lifecycle; grpc/grpc.io (GitHub), core-concepts.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/grpc/grpc.io/main/LICENSE). Copyright gRPC Authors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: gRPC docs, Core concepts, architecture and lifecycle; grpc/grpc.io (GitHub), core-concepts.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/grpc/grpc.io/main/LICENSE). Copyright gRPC Authors.

Cite this

Permanent ID: iil:note:eecpca3f

iinventedlight. 2026. "gRPC services are defined in .proto files with four kinds of RPC methods." iinventedlight Library, iil:note:eecpca3f, version of 2026-11-18. https://iinventedlight.com/library/notes/grpc-service-definition/. License: CC-BY-4.0.

@misc{iil_note_eecpca3f,
  author = {{iinventedlight}},
  title = {{gRPC services are defined in .proto files with four kinds of RPC methods}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/grpc-service-definition/},
  note = {Permanent ID iil:note:eecpca3f. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/grpc-service-definition.md.