Support server-streaming in transcoding - #284
Open
zZHorizonZz wants to merge 5 commits into
Open
Conversation
Member
Author
|
This PR depends on #281 |
zZHorizonZz
force-pushed
the
transcoding-streaming
branch
2 times, most recently
from
August 16, 2026 10:28
53c01e2 to
911fe6b
Compare
zZHorizonZz
marked this pull request as ready for review
August 16, 2026 11:24
zZHorizonZz
force-pushed
the
transcoding-streaming
branch
4 times, most recently
from
August 25, 2026 16:18
857e4de to
4a8f270
Compare
zZHorizonZz
force-pushed
the
transcoding-streaming
branch
from
September 1, 2026 13:21
4a8f270 to
b38488c
Compare
vietj
reviewed
Sep 3, 2026
|
|
||
| === Server-streaming responses | ||
|
|
||
| Server-streaming RPCs (`rpc Foo (Req) returns (stream Resp)`) are transcoded by emitting the response over chunked transfer encoding. The wire format is selected per-request from the HTTP `Accept` header so clients can pick the encoding that fits their consumption pattern without any server configuration: |
Member
There was a problem hiding this comment.
"according to the HTTP accept header letting the client choose the most appropriate encoding"
vietj
reviewed
Sep 3, 2026
| # data: {"payload":"second"} | ||
| ---- | ||
|
|
||
| If the RPC terminates with a non-OK gRPC status before any message has been written, the response is finished with the corresponding HTTP status code and no body. If messages have already been written, the stream ends (with the closing `]` for JSON array mode). Mid-stream errors cannot be signalled on the body since the HTTP status was already sent. |
Member
There was a problem hiding this comment.
Rather:
- gRPC trailers-only response sends the corresponding HTTP status error without content
- gRPC trailers response terminates the response with
], such error cannot be reported to the client
vietj
reviewed
Sep 3, 2026
|
|
||
| If the RPC terminates with a non-OK gRPC status before any message has been written, the response is finished with the corresponding HTTP status code and no body. If messages have already been written, the stream ends (with the closing `]` for JSON array mode). Mid-stream errors cannot be signalled on the body since the HTTP status was already sent. | ||
|
|
||
| Client-streaming and bidirectional-streaming RPCs are not supported by transcoding. |
Member
There was a problem hiding this comment.
rather : Transcoding does not support ...
vietj
requested changes
Sep 3, 2026
vietj
left a comment
Member
There was a problem hiding this comment.
A few docs style wording changes would improve the quality.
… formatting. Motivation: - Extend JSON transcoding support for server-streaming RPCs to enhance compatibility with streaming APIs. - Improve response flexibility with support for JSON Array, NDJSON, and SSE formats based on the `Accept` header. Changes: - Added `streaming` and `StreamFormat` fields to `TranscodingGrpcOutboundStream` for response format negotiation. - Implemented JSON Array, NDJSON, and SSE response formatting for server-streaming. - Derived the streaming cardinality from `ServiceMethod#serverStreaming()`. - Updated `MessageWeaver` to handle `JsonObject` outputs for request/response weaving. - Modified tests to validate new streaming response formats and HTTP transcoding logic. Signed-off-by: Daniel Fiala <danfiala23@gmail.com>
Motivation: - The server-streaming transcoding formats were only covered by unit tests using hand-built service methods, leaving the protoc plugin path untested end to end. Changes: - Exercise the generated `StreamingTranscodingGreeter` service method over HTTP for the JSON array, NDJSON and SSE formats. - Cover the empty stream and the coexistence of the transcoded and gRPC routes for the same method. Signed-off-by: Daniel Fiala <danfiala23@gmail.com>
Motivation: - `GrpcServer#addService` only registered the canonical `/package.Service/Method` path, so the HTTP rules of a transcoded service method were ignored and the transcoded routes returned a 500. `GrpcServer#callHandler` already mounts these paths. Changes: - Mount the `MountPoint` paths of a service method in `addService`, like `callHandler` does. - Add integration tests binding a transcoded unary and server-streaming service with `addService`. Signed-off-by: Daniel Fiala <danfiala23@gmail.com>
… message. Motivation: Transcoding defers the HTTP head until the response body is known, so writeHead returns a promise resolved by writeUnaryMessage. A unary call that ends without ever writing a message never resolves it and leaves the caller waiting. Changes: Resolve the head promise from writeEnd when it is still pending. Fix the indentation of the SSE branch.
Motivation: - Review feedback on the server-streaming transcoding section asked for a more concise wording of the content negotiation and error reporting paragraphs. Changes: - Describe the wire format as selected according to the HTTP `accept` header. - Split the error reporting paragraph into the trailers-only and trailers cases. - Reword the unsupported streaming modes sentence. Signed-off-by: Daniel Fiala <danfiala23@gmail.com>
zZHorizonZz
force-pushed
the
transcoding-streaming
branch
from
September 3, 2026 17:09
b38488c to
fd3fe78
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
Acceptheader.Changes:
streamingandStreamFormatfields toTranscodingGrpcOutboundStreamfor response format negotiation.MessageWeaverto handleJsonObjectoutputs for request/response weaving.grpc-service.mustache) and tests to support method-levelisManyOutputconfigurations.