class

HTTP2::Stream

Inherits Reference < Object

A registered HTTP/2 stream and its bounded inbound event mailbox.

Constructors

new(connection : Connection, id : UInt32, event_capacity : Int32, send_window : Int64, receive_window : Int64, body_capacity : Int32)
Source

Instance methods

abort(error : Exception, error_code : ErrorCode = ErrorCode::CANCEL) : Nil

Terminates local work with a caller-selected public error.

:nodoc:

Source
body
Source
cancel(error_code : ErrorCode = ErrorCode::CANCEL) : Nil

Cancels an active stream with RST_STREAM(CANCEL). An idle stream has not appeared on the wire and is closed locally without sending a reset.

Source
close
Source
closed?
Source
receive(timeout : Time::Span | Nil = nil, cancellation : Channel(Nil) | Nil = nil) : StreamEvent

Waits for the next inbound non-DATA frame or decoded field section. Response DATA is available through #body.

Source
receive_until_remote_end(cancellation : Channel(Nil) | Nil = nil, timeout : Time::Span | Nil = nil) : StreamEvent | Nil

Waits for one metadata event, returning nil when the remote message ends. When timeout is given, raises Connection::TimeoutError instead of continuing to block once it elapses, without otherwise disturbing the stream — used by the response monitor to detect an abandoned response (see HTTP2::Client#monitor_response) while leaving a reader that is still actively draining the body alone.

:nodoc:

Source
receive_window
Source
send(frame : Frames) : Nil

Sends a frame that belongs to this stream through the ordered writer.

Source
send_data(data : Bytes, *, end_stream : Bool = false) : Nil

Sends DATA while respecting connection and stream flow control. Large buffers are split into bounded writer commands and wire frames.

Source
send_data(data : String, *, end_stream : Bool = false) : Nil
Source
send_data(source : IO, *, end_stream : Bool = true) : Nil

Streams an IO without rewinding it. The END_STREAM flag is placed on the final nonempty frame, or on one empty DATA frame when the IO is empty.

Source
send_headers(fields : Enumerable(Tuple(String, String)), *, end_stream : Bool = false) : Nil

Encodes ordered name/value pairs with the default field policy.

Source
send_headers(fields : Enumerable(HeaderField), *, end_stream : Bool = false) : Nil

Encodes and atomically sends an ordered field section.

Source
send_window
Source
state
Source
submit_headers(fields : Enumerable(HeaderField), *, end_stream : Bool = false) : Connection::WriteCommand

Enqueues one ordered field section without waiting for the write to complete. Used only by Client#open_request_stream to release its per-connection opening_mutex before blocking on a write bounded by @timeouts.write — see that method's comment for the wire-ordering argument this depends on.

:nodoc:

Source
terminal_error
Source

Nested types