ServerStream Compatible Server-Sent-Events
Is your feature request related to a problem? Please describe.
Unary RPCs are very well supported in CURL, can't the same be done for server streams, e.g. the Server-Sent-Events approach?
Describe the solution you'd like
ServerStream can be accessed using Server-Sent-Events.
Describe alternatives you've considered If you've proposed a solution, are there any alternatives? Why are they worse than your preferred approach?
Additional context Add any other context or screenshots about the feature request here.
Connect does not use server-sent-events for a few reasons:
- SSE is a text format. It doesn't play nicely with binary payloads, such as binary-encoded protobuf messages. Such messages would need to be pre-encoded, like with base64, which adds overhead.
- SSE is only for messages sent from the server. Using this as the format for client streams (since Connect supports client and bidi-streams, in addition to server streaming) would be awkward because no tooling supports it for constructing request bodies, only for responses. But not using it as the format for client streams would be awkward since it would mean asymmetric stream encoding between client and server streams (and also means we have to implement two forms of stream encoding).
- SSE is quite different from gRPC-web, which is the other protocol that Connect clients generally support. Having such dissimilar stream encodings means it's more effort to create and maintain a new Connect implementation.
FWIW, you can use Connect server streams with curl -- you'll just get 5 bytes of binary "junk" in between each message (most of which will be non-printable characters). If you are using JSON encoding and no compression, that can often be "good enough" for exploratory testing or other manual interactions with a Connect server streaming endpoint.