Struct soketto::connection::Sender
source · pub struct Sender<T> { /* private fields */ }
Expand description
The sending half of a connection.
Implementations§
source§impl<T: AsyncRead + AsyncWrite + Unpin> Sender<T>
impl<T: AsyncRead + AsyncWrite + Unpin> Sender<T>
sourcepub async fn send_text(&mut self, data: impl AsRef<str>) -> Result<(), Error>
pub async fn send_text(&mut self, data: impl AsRef<str>) -> Result<(), Error>
Send a text value over the websocket connection.
sourcepub async fn send_text_owned(&mut self, data: String) -> Result<(), Error>
pub async fn send_text_owned(&mut self, data: String) -> Result<(), Error>
Send a text value over the websocket connection.
This method performs one copy fewer than Sender::send_text
.
sourcepub async fn send_binary(&mut self, data: impl AsRef<[u8]>) -> Result<(), Error>
pub async fn send_binary(&mut self, data: impl AsRef<[u8]>) -> Result<(), Error>
Send some binary data over the websocket connection.
sourcepub async fn send_binary_mut(
&mut self,
data: impl AsMut<[u8]>
) -> Result<(), Error>
pub async fn send_binary_mut(
&mut self,
data: impl AsMut<[u8]>
) -> Result<(), Error>
Send some binary data over the websocket connection.
This method performs one copy fewer than Sender::send_binary
.
The data
buffer may be modified by this method, e.g. if masking is necessary.
sourcepub async fn send_ping(&mut self, data: ByteSlice125<'_>) -> Result<(), Error>
pub async fn send_ping(&mut self, data: ByteSlice125<'_>) -> Result<(), Error>
Ping the remote end.