Struct mediasoup::direct_transport::DirectTransport [−][src]
A direct transport represents a direct connection between the mediasoup Rust process and a
Router
instance in a mediasoup-worker thread.
A direct transport can be used to directly send and receive data messages from/to Rust by means
of DataProducer
s and DataConsumer
s of type Direct
created on a direct transport.
Direct messages sent by a DataProducer
in a direct transport can be consumed by endpoints
connected through a SCTP capable transport (WebRtcTransport
,
PlainTransport
, PipeTransport
and also by the Rust application by means of a DataConsumer
created on a DirectTransport
(and vice-versa: messages sent over SCTP/DataChannel can be consumed by the Rust application by
means of a DataConsumer
created on a DirectTransport
).
A direct transport can also be used to inject and directly consume RTP and RTCP packets in Rust
by using the DirectProducer::send
and
Consumer::on_rtp
API (plus DirectTransport::send_rtcp
and DirectTransport::on_rtcp
API).
Implementations
impl DirectTransport
[src]
pub async fn send_rtcp(
&self,
rtcp_packet: Bytes
) -> Result<(), NotificationError>
[src]
&self,
rtcp_packet: Bytes
) -> Result<(), NotificationError>
Send a RTCP packet from the Rust process.
rtcp_packet
- Bytes containing a valid RTCP packet (can be a compound packet).
pub fn on_rtcp<F: Fn(&Bytes) + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called when the direct transport receives a RTCP packet from its router.
pub fn downgrade(&self) -> WeakDirectTransport
[src]
Downgrade DirectTransport
to WeakDirectTransport
instance.
Trait Implementations
impl Clone for DirectTransport
[src]
fn clone(&self) -> DirectTransport
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for DirectTransport
[src]
impl Transport for DirectTransport
[src]
fn id(&self) -> TransportId
[src]
Transport id.
fn router_id(&self) -> RouterId
[src]
fn app_data(&self) -> &AppData
[src]
Custom application data.
fn closed(&self) -> bool
[src]
fn produce<'life0, 'async_trait>(
&'life0 self,
producer_options: ProducerOptions
) -> Pin<Box<dyn Future<Output = Result<Producer, ProduceError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
producer_options: ProducerOptions
) -> Pin<Box<dyn Future<Output = Result<Producer, ProduceError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Create a Producer.
Transport will be kept alive as long as at least one producer instance is alive.
fn consume<'life0, 'async_trait>(
&'life0 self,
consumer_options: ConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<Consumer, ConsumeError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
consumer_options: ConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<Consumer, ConsumeError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Create a Consumer.
Transport will be kept alive as long as at least one consumer instance is alive.
fn produce_data<'life0, 'async_trait>(
&'life0 self,
data_producer_options: DataProducerOptions
) -> Pin<Box<dyn Future<Output = Result<DataProducer, ProduceDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
data_producer_options: DataProducerOptions
) -> Pin<Box<dyn Future<Output = Result<DataProducer, ProduceDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Create a DataProducer.
Transport will be kept alive as long as at least one data producer instance is alive.
fn consume_data<'life0, 'async_trait>(
&'life0 self,
data_consumer_options: DataConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<DataConsumer, ConsumeDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
data_consumer_options: DataConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<DataConsumer, ConsumeDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Create a DataConsumer.
Transport will be kept alive as long as at least one data consumer instance is alive.
fn enable_trace_event<'life0, 'async_trait>(
&'life0 self,
types: Vec<TransportTraceEventType>
) -> Pin<Box<dyn Future<Output = Result<(), RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
types: Vec<TransportTraceEventType>
) -> Pin<Box<dyn Future<Output = Result<(), RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn on_new_producer(
&self,
callback: Box<dyn Fn(&Producer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&Producer) + Send + Sync + 'static>
) -> HandlerId
fn on_new_consumer(
&self,
callback: Box<dyn Fn(&Consumer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&Consumer) + Send + Sync + 'static>
) -> HandlerId
fn on_new_data_producer(
&self,
callback: Box<dyn Fn(&DataProducer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&DataProducer) + Send + Sync + 'static>
) -> HandlerId
fn on_new_data_consumer(
&self,
callback: Box<dyn Fn(&DataConsumer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&DataConsumer) + Send + Sync + 'static>
) -> HandlerId
fn on_trace(
&self,
callback: Box<dyn Fn(&TransportTraceEventData) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&TransportTraceEventData) + Send + Sync + 'static>
) -> HandlerId
fn on_router_close(
&self,
callback: Box<dyn FnOnce() + Send + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn FnOnce() + Send + 'static>
) -> HandlerId
fn on_close(&self, callback: Box<dyn FnOnce() + Send + 'static>) -> HandlerId
[src]
impl TransportGeneric for DirectTransport
[src]
type Dump = DirectTransportDump
type Stat = DirectTransportStat
Stats data structure specific to each transport.
fn get_stats<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Stat>, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Stat>, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Returns current RTC statistics of the transport.
Check the RTC Statistics section for more details (TypeScript-oriented, but concepts apply here as well).
#[must_use]fn dump<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Dump, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Dump, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations
impl !RefUnwindSafe for DirectTransport
impl Send for DirectTransport
impl Sync for DirectTransport
impl Unpin for DirectTransport
impl !UnwindSafe for DirectTransport
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,