I have a general question about using the Asynchronous APIs. I basically
want to write a client that listens for updates as they are received by the
server.
On the server side, there seem to be multiple ways to define this in the
proto file, and I am not sure which one I should use. Looking at the
examples greeters applications, it looks like one of these streams the
replies while the other does not. This is a bit confusing as the
introduction of the 'stream' keyword does not prevent async communications.
Could someone explain the difference.
Previously, I developed a grpc service using Stream responses using the
Synchronous API, and I could basically have my client wait in a separate
thread for the individual responses to get received. In this case I had
do do quite a bit of thread management on the server and the client which
(if I am not mistaken) I may be able to simplify if I use a truly
asynchronous API.
Below you can see the 2 types of rpc definitions in the proto files I
mentioned above.
// The greeting service definition.
service MultiGreeter {
// Sends multiple greetings
rpc sayHello (HelloRequest) returns (stream HelloReply) {}
}
This is the streaming version
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
Non Streaming version
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/7087cd4b-930f-4766-b040-68f73269dbf4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.