pub struct Session { /* private fields */ }Expand description
A WebTransport Session, able to accept/create streams and send/recv datagrams.
The session can be cloned to create multiple handles. The session will be closed with on drop.
Implementations§
Source§impl Session
impl Session
Sourcepub async fn accept_uni(&mut self) -> Result<RecvStream, Error>
pub async fn accept_uni(&mut self) -> Result<RecvStream, Error>
Block until the peer creates a new unidirectional stream.
Won’t return None unless the connection is closed.
Sourcepub async fn accept_bi(&mut self) -> Result<(SendStream, RecvStream), Error>
pub async fn accept_bi(&mut self) -> Result<(SendStream, RecvStream), Error>
Block until the peer creates a new bidirectional stream.
Sourcepub async fn open_bi(&mut self) -> Result<(SendStream, RecvStream), Error>
pub async fn open_bi(&mut self) -> Result<(SendStream, RecvStream), Error>
Open a new bidirectional stream, which may block when there are too many concurrent streams.
Sourcepub async fn open_uni(&mut self) -> Result<SendStream, Error>
pub async fn open_uni(&mut self) -> Result<SendStream, Error>
Open a new unidirectional stream, which may block when there are too many concurrent streams.
Sourcepub async fn send_datagram(&mut self, payload: Bytes) -> Result<(), Error>
pub async fn send_datagram(&mut self, payload: Bytes) -> Result<(), Error>
Send a datagram over the network.
QUIC datagrams may be dropped for any reason:
- Network congestion.
- Random packet loss.
- Payload is larger than
max_datagram_size() - Peer is not receiving datagrams.
- Peer has too many outstanding datagrams.
- ???
Sourcepub async fn max_datagram_size(&self) -> usize
pub async fn max_datagram_size(&self) -> usize
The maximum size of a datagram that can be sent.
Sourcepub async fn recv_datagram(&mut self) -> Result<Bytes, Error>
pub async fn recv_datagram(&mut self) -> Result<Bytes, Error>
Receive a datagram over the network.
Trait Implementations§
Source§impl From<Session> for Session
Convert a web_transport_quinn::Session into a web_transport::Session.
impl From<Session> for Session
Convert a web_transport_quinn::Session into a web_transport::Session.