connectrpc / connect-go

The Go implementation of Connect: Protobuf RPC that works.
https://connectrpc.com
Apache License 2.0
2.94k stars 96 forks source link

Streams support over http1? #639

Closed Gictorbit closed 10 months ago

Gictorbit commented 10 months ago

Does it support gRPC streams over http1 using websocket? I used this package to convert grpc streams to websocket https://github.com/tmc/grpc-websocket-proxy

jhump commented 10 months ago

@Gictorbit, no it does not. Bidirectional streams only work over HTTP/2. Connect implementations generally implement the specs for gRPC, gRPC-Web, and Connect, none of which make mention of web sockets.

So when using HTTP 1.1, you are limited to server and client streams. If a server sees a request over HTTP 1.1 for a bidirectional streaming method, it will send a "505 HTTP Version Not Supported" error.

We may relax this in the future to allow bidirectional streams over HTTP 1.1, thanks to the newly added support in net/http (link). But even then, only half-duplex style streams can be guaranteed to work, as many peers may be unable to do full-duplex streaming with HTTP 1.1.