pub struct WebTransportSession<C, B>{ /* private fields */ }Expand description
WebTransport session driver.
Maintains the session using the underlying HTTP/3 connection.
Similar to crate::server::Connection it is generic over the QUIC implementation and Buffer.
Implementations§
Source§impl<C, B> WebTransportSession<C, B>
impl<C, B> WebTransportSession<C, B>
Sourcepub async fn accept(
request: Request<()>,
stream: RequestStream<C::BidiStream, B>,
conn: Connection<C, B>,
) -> Result<Self, Error>
pub async fn accept( request: Request<()>, stream: RequestStream<C::BidiStream, B>, conn: Connection<C, B>, ) -> Result<Self, Error>
Accepts a CONNECT request for establishing a WebTransport session.
TODO: is the API or the user responsible for validating the CONNECT request?
Sourcepub fn accept_datagram(&self) -> ReadDatagram<'_, C, B> ⓘ
pub fn accept_datagram(&self) -> ReadDatagram<'_, C, B> ⓘ
Receive a datagram from the client
Sourcepub fn send_datagram(&self, data: B) -> Result<(), Error>where
C: SendDatagramExt<B>,
pub fn send_datagram(&self, data: B) -> Result<(), Error>where
C: SendDatagramExt<B>,
Sends a datagram
TODO: maybe make async. quinn does not require an async send
Sourcepub fn accept_uni(&self) -> AcceptUni<'_, C, B> ⓘ
pub fn accept_uni(&self) -> AcceptUni<'_, C, B> ⓘ
Accept an incoming unidirectional stream from the client, it reads the stream until EOF.
Sourcepub async fn accept_bi(&self) -> Result<Option<AcceptedBi<C, B>>, Error>
pub async fn accept_bi(&self) -> Result<Option<AcceptedBi<C, B>>, Error>
Accepts an incoming bidirectional stream or request
Sourcepub fn open_bi(&self, session_id: SessionId) -> OpenBi<'_, C, B> ⓘ
pub fn open_bi(&self, session_id: SessionId) -> OpenBi<'_, C, B> ⓘ
Open a new bidirectional stream
Sourcepub fn open_uni(&self, session_id: SessionId) -> OpenUni<'_, C, B> ⓘ
pub fn open_uni(&self, session_id: SessionId) -> OpenUni<'_, C, B> ⓘ
Open a new unidirectional stream
Sourcepub fn session_id(&self) -> SessionId
pub fn session_id(&self) -> SessionId
Returns the session id
Auto Trait Implementations§
impl<C, B> !Freeze for WebTransportSession<C, B>
impl<C, B> RefUnwindSafe for WebTransportSession<C, B>
impl<C, B> Send for WebTransportSession<C, B>where
<C as Connection<B>>::OpenStreams: Send,
<C as Connection<B>>::SendStream: Send,
<C as Connection<B>>::BidiStream: Send,
<C as Connection<B>>::RecvStream: Send,
impl<C, B> Sync for WebTransportSession<C, B>where
<C as Connection<B>>::OpenStreams: Send,
<C as Connection<B>>::SendStream: Send,
<C as Connection<B>>::BidiStream: Sync,
B: Sync,
<C as Connection<B>>::RecvStream: Send,
impl<C, B> Unpin for WebTransportSession<C, B>
impl<C, B> UnwindSafe for WebTransportSession<C, B>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more