NAME
Unblock::HTTP3::Body::Stream - writable outgoing HTTP/3 body stream
SYNOPSIS
my $body = $tx->response_body(
on_drain => sub { ... },
on_cancel => sub { ... },
);
if (!$body->write($bytes)) {
# Pause production until on_drain runs.
}
$body->complete;
DESCRIPTION
A Body::Stream sends an HTTP/3 request or response body incrementally.
Body::Stream objects are created by Unblock::HTTP3::Transaction. Applications do not construct them directly.
write uses bounded buffering. A false return means the bytes were accepted, but the producer should pause until on_drain runs.
on_cancel runs if the Transaction ends before body production completes.
METHODS
write
my $can_continue = $body->write($bytes);
Queues body bytes.
Returns true when the producer may continue immediately. Returns false when the bytes were accepted but production should pause for backpressure.
complete
$body->complete;
$body->complete($final_bytes);
Finishes the outgoing body. Optional final bytes are queued before the clean end.
Returns the Body::Stream.
is_complete
True after the producer has completed the body.
is_cancelled
True if the Transaction cancelled the body before normal completion.
SEE ALSO
Unblock::HTTP3::Transaction, Unblock::HTTP3::Body::Reader
AUTHOR
Joshua S. Day
LICENSE
This software is available under the MIT License.