Enum mediasoup::data_consumer::DataConsumer [−][src]
A data consumer represents an endpoint capable of receiving data messages from a mediasoup
Router
.
A data consumer can use SCTP (AKA
DataChannel) to receive those messages, or can directly receive them in the Rust application if
the data consumer was created on top of a
DirectTransport
.
Variants (Non-exhaustive)
Regular(RegularDataConsumer)
Data consumer created on transport other than
DirectTransport
.
Direct(DirectDataConsumer)
Data consumer created on DirectTransport
.
Implementations
impl DataConsumer
[src]
pub fn id(&self) -> DataConsumerId
[src]
Data consumer identifier.
pub fn data_producer_id(&self) -> DataProducerId
[src]
The associated data producer identifier.
pub fn type(&self) -> DataConsumerType
[src]
The type of the data consumer.
pub fn sctp_stream_parameters(&self) -> Option<SctpStreamParameters>
[src]
The SCTP stream parameters (just if the data consumer type is Sctp
).
pub fn label(&self) -> &String
[src]
The data consumer label.
pub fn protocol(&self) -> &String
[src]
The data consumer sub-protocol.
pub fn app_data(&self) -> &AppData
[src]
Custom application data.
pub fn closed(&self) -> bool
[src]
Whether the data consumer is closed.
pub async fn get_stats(&self) -> Result<Vec<DataConsumerStat>, RequestError>
[src]
Returns current statistics of the data consumer.
Check the RTC Statistics section for more details (TypeScript-oriented, but concepts apply here as well).
pub async fn get_buffered_amount(&self) -> Result<u32, RequestError>
[src]
Returns the number of bytes of data currently buffered to be sent over the underlying SCTP association.
Notes on usage
The underlying SCTP association uses a common send buffer for all data consumers, hence the value given by this method indicates the data buffered for all data consumers in the transport.
pub async fn set_buffered_amount_low_threshold(
&self,
threshold: u32
) -> Result<(), RequestError>
[src]
&self,
threshold: u32
) -> Result<(), RequestError>
Whenever the underlying SCTP association buffered bytes drop to this value,
on_buffered_amount_low
callback is called.
pub fn on_message<F: Fn(&WebRtcMessage) + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called when a message has been received from the corresponding data producer.
Notes on usage
Just available in direct transports, this is, those created via
Router::create_direct_transport
.
pub fn on_sctp_send_buffer_full<F: Fn() + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called when a message could not be sent because the SCTP send buffer was full.
pub fn on_buffered_amount_low<F: Fn(u32) + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Emitted when the underlying SCTP association buffered bytes drop down to the value set with
DataConsumer::set_buffered_amount_low_threshold
.
Notes on usage
Only applicable for consumers of type Sctp
.
pub fn on_data_producer_close<F: FnOnce() + Send + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called when the associated data producer is closed for whatever reason. The data consumer itself is also closed.
pub fn on_transport_close<F: FnOnce() + Send + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called when the transport this data consumer belongs to is closed for whatever reason. The data consumer itself is also closed.
pub fn on_close<F: FnOnce() + Send + 'static>(&self, callback: F) -> HandlerId
[src]
Callback is called when the data consumer is closed for whatever reason.
NOTE: Callback will be called in place if data consumer is already closed.
pub fn downgrade(&self) -> WeakDataConsumer
[src]
Downgrade DataConsumer
to WeakDataConsumer
instance.
Trait Implementations
impl Clone for DataConsumer
[src]
fn clone(&self) -> DataConsumer
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for DataConsumer
[src]
impl From<DirectDataConsumer> for DataConsumer
[src]
fn from(producer: DirectDataConsumer) -> Self
[src]
impl From<RegularDataConsumer> for DataConsumer
[src]
fn from(producer: RegularDataConsumer) -> Self
[src]
Auto Trait Implementations
impl !RefUnwindSafe for DataConsumer
impl Send for DataConsumer
impl Sync for DataConsumer
impl Unpin for DataConsumer
impl !UnwindSafe for DataConsumer
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>,