Struct webrtc_data::data_channel::DataChannel
source · pub struct DataChannel {
pub config: Config,
/* private fields */
}
Expand description
DataChannel represents a data channel
Fields§
§config: Config
Implementations§
source§impl DataChannel
impl DataChannel
pub fn new(stream: Arc<Stream>, config: Config) -> Self
sourcepub async fn dial(
association: &Arc<Association>,
identifier: u16,
config: Config
) -> Result<Self, Error>
pub async fn dial( association: &Arc<Association>, identifier: u16, config: Config ) -> Result<Self, Error>
Dial opens a data channels over SCTP
sourcepub async fn accept<T>(
association: &Arc<Association>,
config: Config,
existing_channels: &[T]
) -> Result<Self, Error>where
T: Borrow<Self>,
pub async fn accept<T>(
association: &Arc<Association>,
config: Config,
existing_channels: &[T]
) -> Result<Self, Error>where
T: Borrow<Self>,
Accept is used to accept incoming data channels over SCTP
sourcepub async fn client(stream: Arc<Stream>, config: Config) -> Result<Self, Error>
pub async fn client(stream: Arc<Stream>, config: Config) -> Result<Self, Error>
Client opens a data channel over an SCTP stream
sourcepub async fn server(stream: Arc<Stream>, config: Config) -> Result<Self, Error>
pub async fn server(stream: Arc<Stream>, config: Config) -> Result<Self, Error>
Server accepts a data channel over an SCTP stream
sourcepub async fn read(&self, buf: &mut [u8]) -> Result<usize, Error>
pub async fn read(&self, buf: &mut [u8]) -> Result<usize, Error>
Read reads a packet of len(p) bytes as binary data.
sourcepub async fn read_data_channel(
&self,
buf: &mut [u8]
) -> Result<(usize, bool), Error>
pub async fn read_data_channel( &self, buf: &mut [u8] ) -> Result<(usize, bool), Error>
ReadDataChannel reads a packet of len(p) bytes. It returns the number of bytes read and
true
if the data read is a string.
sourcepub fn messages_sent(&self) -> usize
pub fn messages_sent(&self) -> usize
MessagesSent returns the number of messages sent
sourcepub fn messages_received(&self) -> usize
pub fn messages_received(&self) -> usize
MessagesReceived returns the number of messages received
sourcepub fn bytes_sent(&self) -> usize
pub fn bytes_sent(&self) -> usize
BytesSent returns the number of bytes sent
sourcepub fn bytes_received(&self) -> usize
pub fn bytes_received(&self) -> usize
BytesReceived returns the number of bytes received
sourcepub fn stream_identifier(&self) -> u16
pub fn stream_identifier(&self) -> u16
StreamIdentifier returns the Stream identifier associated to the stream.
sourcepub async fn write(&self, data: &Bytes) -> Result<usize, Error>
pub async fn write(&self, data: &Bytes) -> Result<usize, Error>
Write writes len(p) bytes from p as binary data
sourcepub async fn write_data_channel(
&self,
data: &Bytes,
is_string: bool
) -> Result<usize, Error>
pub async fn write_data_channel( &self, data: &Bytes, is_string: bool ) -> Result<usize, Error>
WriteDataChannel writes len(p) bytes from p
sourcepub async fn close(&self) -> Result<(), Error>
pub async fn close(&self) -> Result<(), Error>
Close closes the DataChannel and the underlying SCTP stream.
sourcepub fn buffered_amount(&self) -> usize
pub fn buffered_amount(&self) -> usize
BufferedAmount returns the number of bytes of data currently queued to be sent over this stream.
sourcepub fn buffered_amount_low_threshold(&self) -> usize
pub fn buffered_amount_low_threshold(&self) -> usize
BufferedAmountLowThreshold returns the number of bytes of buffered outgoing data that is considered “low.” Defaults to 0.
sourcepub fn set_buffered_amount_low_threshold(&self, threshold: usize)
pub fn set_buffered_amount_low_threshold(&self, threshold: usize)
SetBufferedAmountLowThreshold is used to update the threshold. See BufferedAmountLowThreshold().
sourcepub fn on_buffered_amount_low(&self, f: OnBufferedAmountLowFn)
pub fn on_buffered_amount_low(&self, f: OnBufferedAmountLowFn)
OnBufferedAmountLow sets the callback handler which would be called when the number of bytes of outgoing data buffered is lower than the threshold.
Trait Implementations§
source§impl AsRef<DataChannel> for PollDataChannel
impl AsRef<DataChannel> for PollDataChannel
source§fn as_ref(&self) -> &DataChannel
fn as_ref(&self) -> &DataChannel
source§impl Clone for DataChannel
impl Clone for DataChannel
source§fn clone(&self) -> DataChannel
fn clone(&self) -> DataChannel
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more