I don't quite understand the use of this WithBlock and under what circumstances, I hope to get your reply, thank you!
I used it directly when the client connected and found no difference. After the server responded, the client was shut down directly
gRPC.WithBlock()
makes the Dial
(or DialContext
) function block until a connection is established. However this is not necessary for typical operation, as any RPCs you issue on the ClientConn
would, themselves, block until a connection is established (or until an error occurs connecting).
The gRPC team does not recommend the use of this option, and an equivalent is not really available in other language implementations of gRPC.
https://github.com/grpc/grpc-go/pull/6034 is a work in progress doc to explain some of this in more detail.