Server Reflection & Dynamic Clients
Enable gRPC server reflection so tools and clients can discover services and message schemas at runtime without precompiled stubs.
Server Reflection & Dynamic Clients is a free gRPC & High Performance APIs lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the gRPC & High Performance APIs learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The Stub Discovery Problem
Normally a client needs the .proto files compiled into stubs to call a service. That is inconvenient for debugging tools and generic clients.
Server reflection lets a server describe its own API at runtime.
What Reflection Exposes
The reflection service answers questions like:
- Which services does this server host?
- What methods does a service have?
- What are the request/response message schemas?
It returns the underlying FileDescriptorProto data.
Enabling Reflection in Go
Register the reflection service on your gRPC server with a single call.
import 'google.golang.org/grpc/reflection'
s := grpc.NewServer()
pb.RegisterServiceServer(s, &svc{})
reflection.Register(s)Enabling Reflection in Java
In Java add the ProtoReflectionService when building the server.
Server server = ServerBuilder.forPort(9090)
.addService(new MyServiceImpl())
.addService(ProtoReflectionService.newInstance())
.build();Listing Services with grpcurl
With reflection on, grpcurl can list services without a proto file.
grpcurl -plaintext localhost:9090 listDescribing a Method
You can inspect a method's input and output schema directly from the server.
grpcurl -plaintext localhost:9090 describe my.pkg.Service.GetUserCalling Without Stubs
Reflection lets you invoke methods by sending JSON; the tool maps it to protobuf using the discovered schema.
grpcurl -plaintext -d '{"id": 7}' localhost:9090 my.pkg.Service.GetUserDynamic Clients in Code
Libraries can build messages dynamically from descriptors fetched via reflection, enabling generic gateways and admin tools that work against any gRPC server.
The Reflection Protocol
Reflection is itself a gRPC service: grpc.reflection.v1.ServerReflection. It uses a bidirectional stream where clients ask and the server streams back descriptors.
Security Considerations
Reflection reveals your entire API surface. In production:
- Disable it on public-facing edges, or
- Restrict it to internal networks / authenticated callers
It is invaluable in dev and staging.
When to Use It
Reflection shines for debugging, building generic UIs (like BloomRPC/Postman), and admin tooling. For high-throughput app clients, precompiled stubs are still faster and safer.
Quick Check
Test your reflection knowledge.
Recap
You learned server reflection and dynamic clients:
- Reflection lets a server describe its own API at runtime
- Enable it with
reflection.Register(Go) orProtoReflectionService(Java) - Tools like
grpcurlcan list, describe, and call without stubs - Dynamic clients build messages from fetched descriptors
- Restrict reflection in production for security
Frequently asked questions
Is the “Server Reflection & Dynamic Clients” lesson free?
Yes — the full text of “Server Reflection & Dynamic Clients” is free to read here on the web, and the gRPC & High Performance APIs course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the gRPC & High Performance APIs course, upgrade to CoddyKit PRO.
What will I learn in “Server Reflection & Dynamic Clients”?
Enable gRPC server reflection so tools and clients can discover services and message schemas at runtime without precompiled stubs. You practise gRPC & High Performance APIs with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start gRPC & High Performance APIs?
No prior experience is required. gRPC & High Performance APIs on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Server Reflection & Dynamic Clients” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this gRPC & High Performance APIs lesson?
Yes. Every gRPC & High Performance APIs lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- gRPC-Web Integration
- gRPCurl and BloomRPC
- Service Discovery Patterns
- Server Reflection & Dynamic Clients