grpc-kotlin icon indicating copy to clipboard operation
grpc-kotlin copied to clipboard

Expose a callback to eagerly send headers?

Open andrewparmet opened this issue 4 years ago • 1 comments
trafficstars

Now that headers are not sent immediately, I'd like to have a way to trigger headers before I actually have the first response message ready for a client. In grpc-java the usual technique is to cast the StreamObserver to a ServerCallStreamObserver (or a ClientCallStreamObserver when client-side) for these cases, as discussed in https://github.com/grpc/grpc-java/issues/8434.

Could it similarly make sense to expose a custom Flow implementation to expose this kind of behavior?

andrewparmet avatar Oct 08 '21 23:10 andrewparmet

We recently realized we don't want such an API for unary responses for gRPC Java. See https://github.com/grpc/grpc-java/issues/8434#issuecomment-955100019 . For streaming responses it is no problem.

We basically want to keep the door open for batching response headers with the message and trailers. I do recognize that Kotlin's behavior here may have cracked open the door and we may need to keep compatibility options open. (But while we may do something for compatibility, I think we wouldn't have APIs that encourage treating the headers separately for unary.)

ejona86 avatar Oct 29 '21 23:10 ejona86

We're no longer in need of this API. Thanks all.

andrewparmet avatar May 14 '23 23:05 andrewparmet