class
GRPC::Transport::Http2ClientConnection
Overview
Http2ClientConnection manages one HTTP/2 connection from a gRPC client.
Included Modules
Defined in:
grpc/transport/http2_client_connection.crConstant Summary
-
DATA_READ_CB =
LibNghttp2::DataSourceReadCallback.new do |_session, _stream_id, buf, length, data_flags, source, _user_data| sb = Box(SendBuffer).unbox(source.value.ptr) to_copy = (Math.min(length.to_i, sb.remaining)).to_i if to_copy == 0 data_flags.value = data_flags.value | LibNghttp2::DATA_FLAG_EOF next 0_i64 end buf.copy_from(sb.data.to_unsafe + sb.offset, to_copy) sb.offset = sb.offset + to_copy if sb.remaining == 0 data_flags.value = data_flags.value | LibNghttp2::DATA_FLAG_EOF end to_copy.to_i64 end -
DATA_READ_CB_LIVE =
LibNghttp2::DataSourceReadCallback.new do |_session, stream_id, buf, length, data_flags, _source, user_data| conn = Box(Http2ClientConnection).unbox(user_data) conn.read_live_send_data(stream_id, buf, length, data_flags) end
Constructors
Instance Method Summary
- #on_begin_headers_cb(frame : Pointer(Void)) : Nil
- #on_data_chunk_cb(stream_id : Int32, data : Pointer(UInt8), len : LibC::SizeT) : Nil
- #on_frame_recv_cb(frame : Pointer(Void)) : Nil
- #on_header_cb(frame : Pointer(Void), name : Pointer(UInt8), nlen : LibC::SizeT, value : Pointer(UInt8), vlen : LibC::SizeT) : Nil
- #on_stream_close_cb(stream_id : Int32, error_code : UInt32) : Nil
-
#open_bidi_stream_live(service : String, method : String, metadata : Metadata = Metadata.new, send_queue_size : Int32 = 0) : RawBidiCall
open_bidi_stream_live opens a true full-duplex bidi stream.
-
#open_client_stream_live(service : String, method : String, metadata : Metadata = Metadata.new, send_queue_size : Int32 = 0) : RawClientCall
open_client_stream_live opens a live client-streaming RPC.
-
#open_server_stream(service : String, method : String, request_bytes : Bytes, metadata : Metadata = Metadata.new) : RawServerStream
open_server_stream sends one gRPC request and returns a RawServerStream that delivers server-pushed messages as they arrive.
-
#unary_call(service : String, method : String, request_body : Bytes, metadata : Metadata = Metadata.new) : ResponseEnvelope
unary_call sends one gRPC request and blocks until the response arrives.
Instance methods inherited from module GRPC::Transport::ClientTransport
close : Nil
close,
closed? : Bool
closed?,
open_bidi_stream_live(service : String, method : String, metadata : Metadata, send_queue_size : Int32) : RawBidiCall
open_bidi_stream_live,
open_client_stream_live(service : String, method : String, metadata : Metadata, send_queue_size : Int32) : RawClientCall
open_client_stream_live,
open_server_stream(service : String, method : String, request_bytes : Bytes, metadata : Metadata) : RawServerStream
open_server_stream,
unary_call(service : String, method : String, request_body : Bytes, metadata : Metadata) : ResponseEnvelope
unary_call
Instance methods inherited from class GRPC::Transport::Http2Connection
close : Nil
close,
closed? : Bool
closed?,
on_begin_headers_cb(frame : Pointer(Void)) : Nil
on_begin_headers_cb,
on_data_chunk_cb(stream_id : Int32, data : Pointer(UInt8), len : LibC::SizeT) : Nil
on_data_chunk_cb,
on_frame_recv_cb(frame : Pointer(Void)) : Nil
on_frame_recv_cb,
on_frame_send_cb(frame : Pointer(Void)) : Nil
on_frame_send_cb,
on_header_cb(frame : Pointer(Void), name : Pointer(UInt8), nlen : LibC::SizeT, value : Pointer(UInt8), vlen : LibC::SizeT) : Nil
on_header_cb,
on_stream_close_cb(stream_id : Int32, error_code : UInt32) : Nil
on_stream_close_cb,
run_recv_loop : Nil
run_recv_loop
Constructor methods inherited from class GRPC::Transport::Http2Connection
new(socket : IO, peer_address : String = "unknown")
new
Constructor Detail
Instance Method Detail
open_bidi_stream_live opens a true full-duplex bidi stream. Returns a RawBidiCall whose send_raw / close_send / each methods let the caller interleave sends and receives freely. send_queue_size limits how many outgoing frames may be buffered before send_raw blocks the calling fiber (0 = unbounded).
open_client_stream_live opens a live client-streaming RPC. Returns a RawClientCall whose send_raw / close_and_recv methods let the caller send messages incrementally; the server's single response arrives after close_and_recv returns. send_queue_size limits how many outgoing frames may be buffered before send_raw blocks the calling fiber (0 = unbounded).
open_server_stream sends one gRPC request and returns a RawServerStream that delivers server-pushed messages as they arrive.
unary_call sends one gRPC request and blocks until the response arrives.