

But before we start with the codes, pardon me if I’ve missed any code to mention down below. Then, there’s no need to worry because our team has already tested them. If you wonder if the code mentioned below is safe for you or not. Note that servers should only use this mechanism when they need to cancel a call but the payload byte sequence is incomplete. Mapped to call cancellation when sent by a client.Mapped to CANCELLED when sent by a server. UNAVAILABLE - Indicates that no processing occurred and the request can be retried, possibly elsewhere. No mapping as there is no open stream to propagate to. INTERNAL - An explicit GRPC status of OK should have been sent but this might be used to aggressively lameduck in some scenarios. The following mapping from RST_STREAM error codes to GRPC error codes is applied. RPC runtime implementations should interpret RST_STREAM as immediate full-closure of the stream and should propagate an error up to the calling application layer. In some cases it is possible that the framing of the message stream has become corrupt and the RPC runtime will choose to use an RST_STREAM frame to indicate this state to its peer.

When an application or runtime error occurs during an RPC a Status and Status-Message are delivered in Trailers. #Data Frames DATA frame boundaries have no relation to Length-Prefixed-Message boundaries and implementations should make no assumptions about their alignment. NOTE: These id’s are contextual to an open HTTP2 session and will not be unique within a given process that is handling more than one HTTP2 session nor can they be used as GUIDs. We will use HTTP2 stream-ids as call identifiers in this scheme. #Stream Identification All GRPC calls need to specify an internal ID. Grpc-java-android/0.9.1 (gingerbread/1.2.4 nexus5 tmobile) The following structure is recommended to library developers User-Agent → "grpc-" Language ?("-" Variant) "/" Version ?( " (" *(AdditionalProperty " ") ")" ) While the protocol does not require a user-agent to function it is recommended that clients provide a structured user-agent string that provides a basic description of the calling library, version & platform to facilitate issue diagnosis in heterogeneous environments. HEADERS (flags = END_STREAM, END_HEADERS) :path = /2.PublisherService/CreateTopicĪuthorization = Bearer y235.wef315yfh138vh31hv93hv8h3v Sample unary-call showing HTTP2 framing sequence Implementations must synthesize a Status & Status-Message to propagate to the application layer when this occurs.Ĭlients may limit the size of Response-Headers, Trailers, and Trailers-Only, with a default of 8 KiB each suggested. Implementations should expect broken deployments to send non-200 HTTP status codes in responses as well as a variety of non-GRPC content-types and to omit Status & Status-Message. Status must be sent in Trailers even if the status code is OK.įor responses end-of-stream is indicated by the presence of the END_STREAM flag on the last received HEADERS frame that carries Trailers.

Most responses are expected to have both headers and trailers but Trailers-Only is permitted for calls that produce an immediate error. Response-Headers & Trailers-Only are each delivered in a single HTTP2 HEADERS frame block. Trailers-Only → HTTP-Status Content-Type Trailers.Response-Headers → HTTP-Status Content-Type *Custom-Metadata.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. If the Message-Encoding header is omitted then the Compressed-Flag must be 0.įor requests, EOS (end-of-stream) is indicated by the presence of the END_STREAM flag on the last received DATA frame. Compression contexts are NOT maintained over message boundaries, implementations must create a new context for each message in the stream. A value of 0 indicates that no encoding of Message bytes has occurred. Path → “:path” # encoded as 4 byte unsigned integerĪ Compressed-Flag value of 1 indicates that the binary octet sequence of Message is compressed using the mechanism declared by the Message-Encoding header.Call-Definition → Method Scheme Path TE Content-Type.Request-Headers → Call-Definition *Custom-Metadata.Request-Headers are delivered as HTTP2 headers in HEADERS + CONTINUATION frames. Response → (Response-Headers *Length-Prefixed-Message Trailers) / Trailers-Only.Request → Request-Headers *Length-Prefixed-Message EOS.The following is the general sequence of message atoms in a GRPC request & response message stream It assumes familiarity with the HTTP2 specification. This document serves as a detailed description for an implementation of gRPC carried over HTTP2 draft 17 framing.
