gRPC
gRPC is a high-performance RPC framework using Protocol Buffers for serialization.
Overview
Service Discovery
Istek supports two ways to discover gRPC services:
1. Server Reflection (Recommended)
If the server has reflection enabled:
- Select gRPC from the protocol dropdown
- Enter the server URL:
localhost:50051 - Click Discover
Istek will automatically discover all available services and methods.
2. Proto File Upload
If reflection is not available:
- Click the Proto button
- Upload or paste your
.protofile - Click Parse Proto
URL Format
| Format | Description |
|---|---|
localhost:50051 | Plaintext gRPC |
grpc://localhost:50051 | Plaintext gRPC (explicit) |
grpcs://localhost:50051 | gRPC with TLS |
Istek converts grpc:// to http:// and grpcs:// to https:// internally, as required by the gRPC protocol.
Making a Call
After service discovery:
- Select a Service from the dropdown
- Select a Method from the dropdown
- Edit the JSON message
- Add any metadata (optional)
- Click Send
Message Format
gRPC messages are sent as JSON:
{
"name": "World"
}
Istek converts this to the appropriate protobuf format.
Auto-Generated Samples
When you select a method, Istek generates a sample message based on the input schema:
{
"name": "",
"age": 0,
"active": false
}
Metadata
gRPC metadata is equivalent to HTTP headers. Add custom metadata in the Metadata tab:
| Key | Value |
|---|---|
authorization | Bearer {{TOKEN}} |
x-request-id | {{REQUEST_ID}} |
Streaming Types
| Type | Badge | Description |
|---|---|---|
| Unary | Unary | Single request, single response |
| Server Streaming | Server Stream | Single request, stream of responses |
| Client Streaming | Client Stream | Stream of requests, single response |
| Bidirectional | Bidirectional | Stream of requests and responses |
Currently, Istek supports Unary calls. Streaming support is planned for future releases.
Response
The response shows:
- Status Code: gRPC status (0 = OK)
- Status Message: Human-readable status
- Response Time: Call duration
- Data: JSON-formatted response
- Metadata: Response metadata/trailers
Status Codes
| Code | Name | Description |
|---|---|---|
| 0 | OK | Success |
| 1 | CANCELLED | Operation cancelled |
| 2 | UNKNOWN | Unknown error |
| 3 | INVALID_ARGUMENT | Invalid argument |
| 5 | NOT_FOUND | Resource not found |
| 13 | INTERNAL | Internal error |
| 14 | UNAVAILABLE | Service unavailable |
Playground Example
The playground includes a gRPC Greeter service:
URL: localhost:19512
SayHello (Unary)
{
"name": "Istek"
}
Response:
{
"message": "Hello, Istek! Welcome to Istek Playground.",
"timestamp": "2024-01-15T10:30:00Z"
}
Proto Definition
syntax = "proto3";
package playground;
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply);
rpc SayHelloServerStream (HelloRequest) returns (stream HelloReply);
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
string timestamp = 2;
}
Troubleshooting
"Reflection not available"
The server doesn't have reflection enabled. Options:
- Enable reflection on the server
- Upload the proto file manually
"Transport error"
- Check if the server is running
- Verify the port is correct
- Ensure you're using the right scheme (
grpc://vsgrpcs://)
"Method not found"
- Refresh service discovery
- Check if the service name includes the package (e.g.,
package.ServiceName)