Send requests
gRPC requests
How to call a gRPC method from its .proto file in the desktop app, and the limits with streaming methods.
A gRPC request calls one method of a gRPC service. You give Luvin the .proto file that describes the service, choose the method and write the message as JSON.
Example
Section titled “Example”A call to the method SayHello of the service helloworld.Greeter, with the message {"name": "Ana"} and a token as metadata, is saved like this:
name: Say hellokind: grpcurl: localhost:50051metadata: - key: authorization value: Bearer {{token}}proto: protos/helloworld.protoservice: helloworld.Greeterrpc: SayHellomessage: |- { "name": "Ana" }The .proto was imported into the protos/ folder of the collection. Press Invoke and the response shows the status 0 OK and the message the server returned.
Create a gRPC request
Section titled “Create a gRPC request”- In the sidebar, click New request under your collection.
- In the New request dialog, choose gRPC.
- The request opens with the name New gRPC call and the address
localhost:50051.
Call a method
Section titled “Call a method”- Write the address of the server as
host:port, for examplelocalhost:50051. - If the server uses a secure connection, tick TLS.
- In the .proto selector, choose Import .proto… and pick the file. If the file imports other
.protofiles, select them all at once. - In the Method selector, pick the method. Methods are grouped by service.
- In the Message tab, write the message as JSON. When you pick a method and the message is still empty, Luvin fills in a sample message with every field. Use sample message puts the sample back at any time.
- Press Invoke. The response appears below.
The Invoke button stays disabled until the request has an address and a method.
The .proto file
Section titled “The .proto file”Luvin needs the .proto to know the services, the methods and the shape of the messages. It does not ask the server for them: there is no server reflection.
- Imported files are saved in the collection, in a
protos/folder. They travel with the collection like any other file. - Once imported, a
.protoappears in the .proto selector of every gRPC request of the collection. - If the file cannot be read, the error appears under the selectors.
Message and metadata
Section titled “Message and metadata”| Tab | What it holds |
|---|---|
| Message | The request message, as JSON. Field names are the ones in the .proto. |
| Metadata | A key and value table, sent as gRPC metadata. |
A gRPC request has no Authorization tab. If the service needs a token, add it as metadata, for example the key authorization with the value Bearer {{token}}.
Environment {{variables}} work in the address, the message and the metadata.
The response
Section titled “The response”The response shows:
- The gRPC status code and its name, for example
0 OKor5 NOT_FOUND, and the time it took. - Response: each message the server returned, as JSON. If there are several, they are numbered and the header says how many.
- Metadata and Trailers: what the server sent before and after the messages.
When the status is not 0, the details the server gave appear under the status. Copy copies the messages.
Streaming limits
Section titled “Streaming limits”Methods that stream are marked in the Method selector as client stream, server stream or both.
| Method type | What Luvin does |
|---|---|
| Unary | Sends the message and shows the one response. |
| Server streaming | Sends the message and shows every response that arrives. |
| Client streaming | Sends a single message, closes sending and shows the response. |
| Bidirectional | Sends a single message, closes sending and shows every response that arrives. |
Other limits:
- You cannot send several messages on a client stream.
- Luvin keeps up to 500 response messages of a stream.
- A call has 30 seconds to finish. After that it ends with the status
DEADLINE_EXCEEDED. - A gRPC request cannot be used as a workflow step.