Reputation: 2482
What is the standard way for a remote client to discover available services on gRPC server? I know there is something called gRPC reflection. But how do we use it? I am looking for language agnostic solution (provided gRPC support)
Upvotes: 4
Views: 2940
Reputation: 683
I see that my answer can be useless looking at the date of the question.
As far as I understand browsing log files and deploying reflection
feature, a grpc client sends POST request /grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo
using HTTP/2.0
protocol to grpc server to receive the list of exposed services and their methods, for instance:
$ grpcurl --plaintext host:8000 list
grservices.diagnostic
$ ~/gopath/bin/grpcurl --plaintext host:8000 list grservices.diagnostic
GetDateTime
GetTimeZones
Log:
"POST /grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo HTTP/2.0"
"POST /grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo HTTP/2.0"
Upvotes: 6