In this article, I’ll cover a gRPC call using Server Streaming response - implementing a client and server Go applications.

This is the third article of the series:

  1. How to Make Effective Unary Calls
  2. How to Make Client Streaming Calls
  3. How to Make Server Streaming Calls
  4. How to Make Bi-directional Streaming Calls

In a server streaming rpc call, the client sends a single request, and the server responds with a stream of messages. This is useful when the server needs to do bulks operations, and instead of waiting until the server finishes processing the data, the server can send objects one by one using streaming.

Image for post

Server Streaming Response

Project Description

For this project, we will create a Documents service with one gRPC endpoint that will allow the client to send a request to fetch documents.

The endpoint will not require any request message, so we will send an empty hash.

The server then will process some documents and start sending streaming responses to the client.

The client can also stop accepting messages from the server at any point in time, either because it already got what it wanted, or because the server is taking too long to send messages.

#golang #programming #grpc

gRPC: How to Make Server Streaming Calls
1.25 GEEK