This repository contains simple and educational examples of using gRPC in Go. It covers various RPC patterns including unary, client streaming, server streaming, and bidirectional streaming.
- The server listens on port
50051. - The client sends a single integer value (e.g.,
4) to the server. - The server responds with the square of the number (e.g.,
16).
- The server listens on port
50051. - The client establishes a bidirectional stream with the server.
- Both client and server send 5 messages to each other through the stream.
- The server listens on port
50051. - The client streams multiple messages to the server.
- The server counts the number of received messages.
- When the client finishes (EOF), the server responds with the total count.
- The server listens on port
50051. - The client sends a single number (e.g.,
5) to the server. - The server logs the number and streams 5 messages back to the client.
Each program demonstrates how to implement and run different types of gRPC functions using Go.
For each program:
# Run server
go run server.go
# Run client
go run client.go