Skip to Content
🎉 gRPCity 3.0 is released. Read more →
文档高级功能gRPC Reflection

gRPC Reflection

gRPCity 服务端实现了 gRPC Server Reflection Protocol,Postman、grpcurl 这类工具可以直接在 wire 上探测你的服务,不需要本地的 .proto 文件副本。

用法

从 loader 构造反射服务并注入到 server:

const server = await loader.initServer() const reflection = await loader.initReflection() server.inject(reflection)

Unary Call

我们使用 gRPCity 里的 example/reflection/helloworldServer.js 作为 Unary Call 例子。

Terminal
node example/reflection/helloworldServer.js start: localhost:9098

服务启动后就可以使用postman进行接入测试,演示如下:

Async Stream

我们使用 gRPCity 里的 example/reflection/asyncStreamServer.js 作为 Async Stream 例子。

Terminal
node example/reflection/asyncStreamServer.js start: localhost:9097

服务启动后就可以使用postman进行接入测试,演示如下:

Client Stream

Server Stream

Bidi Stream

Last updated on