Slide 12
Slide 12 text
gRPC Bidirectional Streaming
● 俗に言う双方向通信
● クライアント、サーバー相互に任意のタイミングでデータ送信が行える
● oneofを使用し、一つのstreamで複数のコマンドを定義
message Notify {
// どれか1つの情報がくるので、
switchなどで処理を振り分ける
oneof event {
ChatInfo chat_info = 1;
Actor join_actor = 2;
…
}
}
service StreamingService {
rpc StartNotify(...) returns (stream Notify) {}
…
}