Menu

Post image 1
Post image 2
1 / 2
0

One port, two protocols: gRPC + REST with Connect-RPC in Rust

DEV Community: grpc·greymoth·3 days ago
#j86SCfdG
#dev#grpc#clients#json#connect#photo
Reading 0:00
15s threshold

When we built the guardian service for kairon.trade, we had the usual dilemma: ship a gRPC API for internal services, or a REST/JSON API for browser clients. Both have merit. Running two separate servers doubles the surface area. Connect-RPC solved this cleanly. What Connect-RPC does Connect is a protocol that runs on HTTP/1.1 and HTTP/2. A single handler can serve: gRPC clients (HTTP/2, binary protobuf) gRPC-web clients (HTTP/1.1, protobuf or JSON) Connect clients (HTTP/1.1 or HTTP/2, JSON or protobuf) Content-type negotiation happens transparently. The handler code is protocol-agnostic. The setup kairon-guardian is written in Rust. We use the connectrpc crate to expose services defined in .proto files as both gRPC and REST/JSON endpoints on a single :9000 listener. No Envoy. No sidecar. No port split. One binary, one port, two protocols. Why this matters Before: internal Rust services spoke gRPC, browser clients needed a separate REST layer with its own routing, serialisation, and error handling.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More