gRPC Playgorund

Features

  1. Based on Protocol Buffers and HTTP/2
  2. Supports SSL
  3. Data types: bool, int, float, string, bytes, list, map, structs...
  4. Pre-defined set of error codes
  5. Streaming RPC -- sending multiple messages per channel (uni- or bidirectional)
  6. Multiplexing -- handling multiple channels over one connection
  7. Deadlines and cancels

Python

grpcio library is needed only for file generation not for runtime.

grpclib provides asyncio-compatible gRPC interface for Python.

To re-generate Python definitions run:

python -m grpc_tools.protoc --proto_path=. --python_out=python  --python_grpc_out=python helloworld.proto

To start server run:

python python/server.py localhost <PORT> keys/server.crt keys/server.key keys/client.crt

To start client run:

python python/client.py localhost <PORT> keys/client.crt keys/client.key keys/server.crt

Rust

Available libs:

  1. grpc-rust -- Pure Rust implementation, under development (generally works, but has poor performance). Potentially Tokio-compatible (See this issue).
  2. grpc-rs -- Wrapper for C++, under development (some features are missing, e.g. reflection, custom metadata and authentication) -- this one is used here
  3. tower-grpc -- Pure Rust implementation based on Tower, very immature.

To re-generate Rust definitions install protobuf-codegen and grpcio-compiler and run:

python -m grpc_tools.protoc 
    --proto_path=.
    --rust_out=rust/helloworld/src
    --grpc_out=rust/helloworld/src
    --plugin=protoc-gen-grpc="<PATH_TO_`grpc_rust_plugin`_EXECUTABLE>"
    helloworld.proto

To start server run:

./rust/helloworld/target/debug/server.exe localhost <PORT> keys/server.crt keys/server.key keys/client.crt

To start client run:

./rust/helloworld/target/debug/client.exe localhost <PORT> keys/client.crt keys/client.key keys/server.crt

Other notes

grpc_cli has to be built from sources link