grpc-kotlin
grpc-kotlin copied to clipboard
Expose a callback to eagerly send headers?
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?
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.)
We're no longer in need of this API. Thanks all.