Skip to Content
Practical Go
book

Practical Go

by Amit Saha
December 2021
Beginner to intermediate
416 pages
9h 36m
English
Wiley
Content preview from Practical Go

CHAPTER 9Advanced gRPC Applications

In the first half of this chapter, you will learn how to implement streaming communication patterns in gRPC applications. In the latter half, you will learn to implement common server and client functionality as middleware components. Along the way, you will learn how to send and receive binary data and understand more about Protocol Buffers. Let's jump in!

Streaming Communication

As you learned in Chapter 8, data is exchanged between client and server as protobuf messages. You learned to build gRPC applications following the Unary RPC pattern. In this pattern, a client sends a request to the server and then waits for the server to send back a response. More specifically, the client application calls an RPC method, sends a request as a protobuf message, and then waits for the response message from the server. There is only one message exchange that happens between the client and the server.

Next, we are going to learn three new communication patterns: server-side streaming, client-side streaming, and a combination of the two, bidirectional streaming. In these three patterns, it is possible to exchange more than one request and response message during a single method call. Let's learn about these, starting with server-side streaming.

Server-Side Streaming

In server-side streaming, when a client makes a request, the server may send more than one response message. Consider the GetRepos( ) RPC method of the Repo service that we implemented ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Mastering Go - Third Edition

Mastering Go - Third Edition

Mihalis Tsoukalos
Efficient Go

Efficient Go

Bartlomiej Plotka
GitOps Cookbook

GitOps Cookbook

Natale Vinto, Alex Soto Bueno

Publisher Resources

ISBN: 9781119773818Purchase Link