pub struct WebTransportConnection { /* private fields */ }Expand description
A handle to an active WebTransport session.
Passed to your WebTransportHandler when a client opens a WebTransport session.
Use it to accept streams from the client, open server-initiated streams, and exchange
datagrams.
Implementations§
Source§impl WebTransportConnection
impl WebTransportConnection
Sourcepub async fn accept_bidi(&self) -> Option<InboundBidiStream>
pub async fn accept_bidi(&self) -> Option<InboundBidiStream>
Accept the next inbound bidirectional stream for this session.
Returns None when the session is shutting down or the QUIC connection has closed.
Sourcepub fn h3_connection(&self) -> &H3Connection
pub fn h3_connection(&self) -> &H3Connection
Returns the underlying HTTP/3 connection.
Sourcepub fn upgrade(&self) -> &Upgrade
pub fn upgrade(&self) -> &Upgrade
Returns the HTTP CONNECT upgrade that initiated this WebTransport session.
Provides access to request headers, connection state, and peer information from the CONNECT request.
Sourcepub fn upgrade_mut(&mut self) -> &mut Upgrade
pub fn upgrade_mut(&mut self) -> &mut Upgrade
Returns a mutable reference to the HTTP CONNECT upgrade that initiated this session.
Sourcepub async fn accept_uni(&self) -> Option<InboundUniStream>
pub async fn accept_uni(&self) -> Option<InboundUniStream>
Accept the next inbound unidirectional stream for this session.
Returns None when the session is shutting down or the QUIC connection has closed.
Sourcepub async fn recv_datagram(&self) -> Option<Datagram>
pub async fn recv_datagram(&self) -> Option<Datagram>
Receive the next datagram for this session.
Returns None when the session is shutting down or the QUIC connection has closed.
Sourcepub async fn accept_next_stream(&self) -> Option<InboundStream>
pub async fn accept_next_stream(&self) -> Option<InboundStream>
Accept the next inbound stream for this session.
Races the bidi and uni stream channels and returns whichever arrives first.
Returns None when the session ends.
Datagrams are intentionally excluded — use recv_datagram
in a separate concurrent loop, as datagrams typically require lower latency
than stream acceptance.
Sourcepub fn send_datagram(&self, payload: &[u8]) -> Result<()>
pub fn send_datagram(&self, payload: &[u8]) -> Result<()>
Send an unreliable datagram to the client.
Returns an error if the QUIC connection does not support datagrams or the payload is too large.
Sourcepub async fn open_bidi(&self) -> Result<OutboundBidiStream>
pub async fn open_bidi(&self) -> Result<OutboundBidiStream>
Open a new server-initiated bidirectional stream for this session.
Sourcepub async fn open_uni(&self) -> Result<OutboundUniStream>
pub async fn open_uni(&self) -> Result<OutboundUniStream>
Open a new server-initiated unidirectional stream for this session.