abstract gRPC protocol clarification: client half-closing

23 views
Skip to first unread message

Piotr Morgwai Kotarbinski

unread,
May 30, 2021, 3:26:51 AMMay 30
to grpc.io
Hi all,
One thing that is unclear to me is how a streaming client signals end of its stream to a server (so called 'client half-closing'). The abstract part says nothing about it. My only guess that in case of HTTP/2 implementation clients basically close their input stream, but not sure about it. Could someone with a deep knowledge of the protocol clarify this please?

Thanks!

Piotr Morgwai Kotarbinski

unread,
May 30, 2021, 10:18:13 AMMay 30
to grpc.io
I've noticed that in case of the java client code, calling `requestObserver.onCompleted()` results in a call to `io.netty.handler.codec.http2.DefaultHttp2FrameWriter.writeData(...)` with `endStream` param set to `true` in case of netty, and in case of okHttp in a call to `io.grpc.okhttp.internal.framed.Http2.Writer.data()` with `outFinished` param set to `true`. In both cases this results in `END_STREAM` flag to be set, so it seems my guess was correct. However some confirmation from someone more familiar with the protocol internals would be welcomed :)

Thanks!

Sanjay Pujare

unread,
May 30, 2021, 1:49:50 PMMay 30
to Piotr Morgwai Kotarbinski, grpc.io

"For requests, EOS (end-of-stream) is indicated by the presence of the END_STREAM flag on the last received DATA frame. In scenarios where the Request stream needs to be closed but no data remains to be sent implementations MUST send an empty DATA frame with this flag set."


--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/87e3fc86-f3c4-4c5a-8be7-e0b773b078d1n%40googlegroups.com.

Piotr Morgwai Kotarbinski

unread,
Jun 1, 2021, 4:38:50 AMJun 1
to grpc.io
Thanks for the answer! I've created a tiny PR with docs update: https://github.com/grpc/grpc/pull/26396

Thanks!

Reply all
Reply to author
Forward
0 new messages