pub struct WebRtcProtocolHandler { /* private fields */ }Expand description
WebRTC protocol handler for SharedTransport.
Routes incoming streams to the appropriate WebRTC subsystem based on stream type:
WebRtcSignal(0x20): SDP offers/answers, ICE candidatesWebRtcMedia(0x21): RTP packets for audio/videoWebRtcData(0x22): Data channel messages
Implementations§
Source§impl WebRtcProtocolHandler
impl WebRtcProtocolHandler
Sourcepub fn new(
config: WebRtcHandlerConfig,
) -> (Self, Receiver<WebRtcIncoming>, Receiver<WebRtcIncoming>, Receiver<WebRtcIncoming>)
pub fn new( config: WebRtcHandlerConfig, ) -> (Self, Receiver<WebRtcIncoming>, Receiver<WebRtcIncoming>, Receiver<WebRtcIncoming>)
Create a new WebRTC protocol handler.
Returns the handler and receivers for each message type.
Sourcepub fn with_defaults() -> (Self, Receiver<WebRtcIncoming>, Receiver<WebRtcIncoming>, Receiver<WebRtcIncoming>)
pub fn with_defaults() -> (Self, Receiver<WebRtcIncoming>, Receiver<WebRtcIncoming>, Receiver<WebRtcIncoming>)
Create with default configuration.
Sourcepub async fn session_count(&self) -> usize
pub async fn session_count(&self) -> usize
Get number of active sessions.
Sourcepub async fn get_session_stats(&self, peer: &PeerId) -> Option<(u64, Vec<u32>)>
pub async fn get_session_stats(&self, peer: &PeerId) -> Option<(u64, Vec<u32>)>
Get session info for a peer.
Sourcepub async fn remove_session(&self, peer: &PeerId)
pub async fn remove_session(&self, peer: &PeerId)
Remove a peer session.
Source§impl WebRtcProtocolHandler
impl WebRtcProtocolHandler
Sourcepub fn route_packet_to_stream(payload: &[u8]) -> StreamType
pub fn route_packet_to_stream(payload: &[u8]) -> StreamType
Sourcepub fn stream_media_type(stream_type: StreamType) -> &'static str
pub fn stream_media_type(stream_type: StreamType) -> &'static str
Trait Implementations§
Source§impl ProtocolHandler for WebRtcProtocolHandler
impl ProtocolHandler for WebRtcProtocolHandler
Source§fn stream_types(&self) -> &[StreamType]
fn stream_types(&self) -> &[StreamType]
Get the stream types this handler processes.
Source§fn handle_stream<'life0, 'async_trait>(
&'life0 self,
peer: PeerId,
stream_type: StreamType,
data: Bytes,
) -> Pin<Box<dyn Future<Output = TransportResult<Option<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_stream<'life0, 'async_trait>(
&'life0 self,
peer: PeerId,
stream_type: StreamType,
data: Bytes,
) -> Pin<Box<dyn Future<Output = TransportResult<Option<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle an incoming stream. Read more
Source§fn handle_datagram<'life0, 'async_trait>(
&'life0 self,
peer: PeerId,
stream_type: StreamType,
data: Bytes,
) -> Pin<Box<dyn Future<Output = TransportResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_datagram<'life0, 'async_trait>(
&'life0 self,
peer: PeerId,
stream_type: StreamType,
data: Bytes,
) -> Pin<Box<dyn Future<Output = TransportResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle an incoming datagram. Read more
Auto Trait Implementations§
impl !Freeze for WebRtcProtocolHandler
impl !RefUnwindSafe for WebRtcProtocolHandler
impl Send for WebRtcProtocolHandler
impl Sync for WebRtcProtocolHandler
impl Unpin for WebRtcProtocolHandler
impl !UnwindSafe for WebRtcProtocolHandler
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> ProtocolHandlerExt for Twhere
T: ProtocolHandler + 'static,
impl<T> ProtocolHandlerExt for Twhere
T: ProtocolHandler + 'static,
Source§fn boxed(self) -> Box<dyn ProtocolHandler>
fn boxed(self) -> Box<dyn ProtocolHandler>
Box this handler for use with
crate::SharedTransport.