- Based on Protocol Buffers and HTTP/2
- Supports SSL
- Data types: bool, int, float, string, bytes, list, map, structs...
- Pre-defined set of error codes
- Streaming RPC -- sending multiple messages per channel (uni- or bidirectional)
- Multiplexing -- handling multiple channels over one connection
- Deadlines and cancels
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
Available libs:
grpc-rust
-- Pure Rust implementation, under development (generally works, but has poor performance). Potentially Tokio-compatible (See this issue).grpc-rs
-- Wrapper for C++, under development (some features are missing, e.g. reflection, custom metadata and authentication) -- this one is used heretower-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
grpc_cli
has to be built from sources link