0Pricing
gRPC & High Performance APIs · 강의

스트리밍 RPC: 서버, 클라이언트 및 양방향

단항 호출을 넘어, 한 번의 호출로 메시지 시퀀스를 전송하는 gRPC의 세 가지 스트리밍 모드를 학습합니다.

스트리밍 RPC: 서버, 클라이언트 및 양방향은(는) CoddyKit의 무료 gRPC & High Performance APIs 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 gRPC & High Performance APIs 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. gRPC & High Performance APIs 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Beyond Unary

A unary RPC is one request, one response. But many problems need a sequence of messages — feeds, uploads, chat.

gRPC offers three streaming modes built on HTTP/2 streams.

The Four Method Shapes

In a .proto service you can declare:

  • Unary: one in, one out.
  • Server streaming: one in, many out.
  • Client streaming: many in, one out.
  • Bidirectional: many in, many out.

Declaring Streams in Proto

The stream keyword marks a parameter as a stream.

service Feed {
  rpc Watch (WatchRequest) returns (stream Event);
  rpc Upload (stream Chunk) returns (UploadResult);
  rpc Chat (stream Message) returns (stream Message);
}

Server Streaming

The client sends one request; the server replies with many messages until it closes the stream.

Great for: live feeds, large result sets, progress updates.

// Server side (Go-style pseudocode)
func (s *server) Watch(req *WatchRequest, stream Feed_WatchServer) error {
  for _, e := range events {
    stream.Send(e)
  }
  return nil
}

Client Streaming

The client sends many messages, then the server returns a single response.

Great for: file uploads, batched ingestion, aggregations.

// Server reads the whole client stream, then replies once
func (s *server) Upload(stream Feed_UploadServer) error {
  for {
    chunk, err := stream.Recv()
    if err == io.EOF {
      return stream.SendAndClose(&UploadResult{})
    }
  }
}

Bidirectional Streaming

Both sides send streams independently over the same call. Messages can interleave freely.

Great for: chat, real-time collaboration, interactive protocols.

Why It's Efficient

All four shapes ride a single HTTP/2 stream — no new connection per message.

Multiplexing means many streaming calls share one connection without head-of-line blocking.

Flow Control

HTTP/2 provides built-in flow control, so a slow reader naturally backpressures a fast writer.

This prevents a streaming server from overwhelming a client that can't keep up.

Ending a Stream

Streams close explicitly:

  • Server streaming ends when the server returns.
  • Client streaming ends when the client signals end-of-stream and the server replies.
  • Bidirectional ends when both halves complete or an error/cancel occurs.

Errors & Cancellation

Either side can cancel or fail mid-stream. The peer receives a status code and should clean up.

Always handle EOF and error returns from Recv() / Send() to avoid leaks.

Choosing a Mode

Pick by data shape:

  • One-shot request/response: unary.
  • Push many results: server streaming.
  • Send many, get a summary: client streaming.
  • Continuous two-way: bidirectional.

Quick Check

Test your understanding of streaming RPCs.

Recap

You learned gRPC's streaming modes.

  • Unary, server streaming, client streaming, and bidirectional.
  • Mark streams with the stream keyword in proto.
  • All ride a single multiplexed HTTP/2 stream with built-in flow control.
  • Choose the mode that matches your data's shape.

자주 묻는 질문

“스트리밍 RPC: 서버, 클라이언트 및 양방향” 강의는 무료인가요?

네 — “스트리밍 RPC: 서버, 클라이언트 및 양방향” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 gRPC & High Performance APIs 강의 전체를 잠금 해제할 수 있습니다. gRPC & High Performance APIs 강의에는 총 4개의 강의가 포함되어 있습니다.

“스트리밍 RPC: 서버, 클라이언트 및 양방향”에서 뭘 배우나요?

단항 호출을 넘어, 한 번의 호출로 메시지 시퀀스를 전송하는 gRPC의 세 가지 스트리밍 모드를 학습합니다. 브라우저에서 직접 실행하는 실습 코드로 gRPC & High Performance APIs을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

gRPC & High Performance APIs을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 gRPC & High Performance APIs은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“스트리밍 RPC: 서버, 클라이언트 및 양방향” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 gRPC & High Performance APIs 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 gRPC & High Performance APIs 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. Protobuf 스키마 정의
  2. gRPC 코드 생성
  3. 간단한 단항 gRPC 서비스
  4. 스트리밍 RPC: 서버, 클라이언트 및 양방향
← gRPC & High Performance APIs(으)로 돌아가기