NAME

Unblock::HTTP3::Extension::Stream - HTTP/3 extension unidirectional stream

SYNOPSIS

$h3->extension_stream_handler(
    $type,
    sub {
        my ($h3, $stream) = @_;

        while (defined(my $chunk = $stream->next_chunk)) {
            ...
        }
    },
);

my $stream = $h3->open_extension_stream($type);
$stream->send($bytes);
$stream->finish;

DESCRIPTION

This object represents one generic HTTP/3 extension unidirectional stream.

Unblock::HTTP3 owns the stream-type prefix. The extension owns the bytes after that prefix.

Incoming streams can be polled with next_chunk or configured with callbacks. Outgoing streams use send, send_some, and finish.

METHODS

type

Returns the HTTP/3 extension stream type.

id

Returns the underlying QUIC stream ID.

incoming

True when the stream was opened by the peer.

can_send

True when this endpoint can send on the stream.

can_receive

True when this endpoint can receive on the stream.

configure

$stream->configure(
    on_data  => sub { ... },
    on_end   => sub { ... },
    on_reset => sub { ... },
    on_stop  => sub { ... },
    on_drain => sub { ... },
);

Configures optional callbacks and returns the Stream.

next_chunk

Returns the next received payload chunk, or undef.

Consuming a chunk returns its QUIC receive credit.

send

Queues payload bytes for reliable delivery.

send_some

Uses the bounded Net::QUIC transmit path and returns the number of payload bytes accepted.

If fewer bytes are accepted, on_drain runs when the producer can try again.

finish

Cleanly closes the outgoing stream.

stop_sending

Stops an incoming stream with an optional application error code.

reset

Resets an outgoing stream with an optional application error code.

acked_offset

Returns the acknowledged payload offset.

The HTTP/3 stream-type prefix is not included.

is_complete

True after a clean end in the available stream direction.

is_reset

True after the peer resets an incoming extension stream.

reset_code

Returns the peer reset code, or undef.

is_stopped

True after the peer sends STOP_SENDING for an outgoing extension stream.

stop_code

Returns the peer STOP_SENDING code, or undef.

SEE ALSO

Unblock::HTTP3::Connection, Net::QUIC::Stream

AUTHOR

Joshua S. Day

LICENSE

This software is available under the MIT License.