grpc-async
grpc-async copied to clipboard
Asynchronous gRPC request & response with goroutine and communication pattern
grpc-async(peer)
Example code of asynchronous communication using gRPC with goroutine
go get google.golang.org/grpc
Multiple request
Client sends multiple messages asynchronously with go routine. This is useful when client don't need to wait response.
Atomic counter
Client send a request asynchronously without immediate response. Client send another request to increase atomic counter on server side. When the counter has value of 2, original request is going to get a response.
Relay server
It would be useful when a program has both client side and server side. An example of this is relay server. It waits for cilent's request and relay this to the different server. Picture below shows the communication process.
