[grpc design] Never ending bidirectionnal stream use case

60 views
Skip to first unread message

David Audrain

unread,
May 10, 2018, 11:35:23 AM5/10/18
to grpc.io
Hi, 

Our client application and our server will continuously exchange messages:
  • Client may send a message containing a gps coordinate every 10 seconds to the server
  • Server may send a message containing geolocalized information
    • If there is nothing close the client gps position, server sends nothing
    • If an incoming information appears close the client gps position, server push a message to the client
We plan to define our service like this:
service Information

  rpc
GetInformation(stream ClientPosition) returns (stream GeoInformation);
}



From an implementation point of view, client and server will keep sending and receiving message forever.
They won't call grpc::ClientReaderWriter::WritesDone at any time, or may be only if  grpc::ClientReaderWriter::Write or grpc::ClientReaderWriter::Read return false.

We didn't see any such use case in C++ examples in the github gRPC repository. Stream based examples assumes that client or server will write a sequence of messages, indicate the sequence is finished, then read a sequence as a response. done. 

Is a never ending bidirectionnal stream a valid usage of gRPC ?

Thank you,
David

David Audrain

unread,
May 11, 2018, 9:39:42 AM5/11/18
to grpc.io
According to this documentation, this is a valid usage.
Reply all
Reply to author
Forward
0 new messages