10分钟
4.8.3 服务的方法列表
继续使用list子命令还可以查看HelloService服务的方法列表:
$ grpcurl -plaintext localhost:1234 list HelloService.HelloService
Channel
Hello从输出可以看到HelloService服务提供了Channel和Hello两个方法,和Protobuf文件的定义是一致的。
如果还想了解方法的细节,可以使用grpcurl提供的describe子命令查看更详细的描述信息:
$ grpcurl -plaintext localhost:1234 describe HelloService.HelloService
HelloService.HelloService is a service:
{
"name": "HelloService",
"method": [
{
"name": "Hello",
"inputType": ".HelloService.String",
"outputType": ".HelloService.String",
"options": {
}
},
{
"name": "Channel",
"inputType": ".HelloService.String",
"outputType": ".HelloService.String",
"options": {
},
"clientStreaming": true,
"serverStreaming": true
}
],
"options": {
}
}输出列出了服务的每个方法,每个方法输入参数和返回值对应的类型。
学员评价