ConnectRPC support for gRPC service
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 223
- Avg merge
- 18m
- Merged PRs (30d)
- 1
Description
## Feature Request
### Crates
volo-grpc
### Motivation
ConnectRPC allows gRPC services to be called directly from browsers and with tools like cURL, without needing proxies or gateways. This would make Volo services much easier to integrate with web frontends.
Example - calling a service with cURL:
```bash
curl --header "Content-Type: application/json" \
--data '{"name": "test"}' \
https://api.example.com/service.v1.MyService/Method
```
### Proposal
Add ConnectRPC protocol support to `volo-grpc` so a single server can handle:
- Standard gRPC (for service-to-service)
- Connect protocol (for browsers, buf curl and its toolchain)
The implementation would detect the protocol based on Content-Type headers and handle Connect's simpler HTTP/1.1 compatible format for unary calls. For streaming RPC I think it's a bit tricky, especially for the bidirectional streaming as it currently only supported with HTTP/2 transport, however there's a potential where it can be established with HTTP/1.1 by doing chunked transfer encoding, and to note that the server should support full duplex (eg. in Go https://pkg.go.dev/net/http#ResponseController.EnableFullDuplex)
### Alternatives
TBD
Contributor guide
Assessment
This issue has not been assessed yet.