Skip to content

Clients

Warning

Make sure to enable client generation when compiling your code. See [TODO link]

Synchronous clients

Compile the following proto file in a directory called example, with the generation of synchronous clients activated.

syntax = "proto3";

message Request {}
message Response {}

service MyService {
    rpc MyRPC(Request) returns (Response);
}

The synchronous client can be used as follows:

import grpc

from example import Request, MyServiceStub

with grpc.insecure_channel("address:port") as channel:
    client = MyServiceStub(channel)

    response = client.my_rpc(Request())

Asynchronous clients

With grpcio

Warning

No yet supported

With grpclib

Warning

Documentation not yet available