INNER CODE UNIT · Rust
send
webrtc-rs/webrtc · src/data_channel/mod.rs:161
async fn send(&self, data: BytesMut) -> Result<()>;
/// Sends text data on this data channel.
///
/// Blocking/non-blocking behaviour and error contract match [`send`](Self::send): with a
/// configured send-buffer limit it blocks until the buffer is below the limit, and
/// returns [`Error::ErrDataChannelClosed`] on a closing/closed channel. Use
/// [`try_send_text`](Self::try_send_text) for the non-blocking variant.
///
/// # Examples
///
/// ```no_run
/// # use webrtc::error::Result;
/// # use webrtc::data_channel::DataChannel;
/// # use std::sync::Arc;
/// # async fn example(dc: Arc<dyn DataChannel>) -> Result<()> {
/// dc.send_text("Hello, WebRTC!").await?;
/// # Ok(())
/// # }