pub struct WSWriter {
pub writer: Arc<Mutex<Writer>>,
pub web_socket_config: WebSocketConfig,
/* private fields */
}
Fields§
§writer: Arc<Mutex<Writer>>
§web_socket_config: WebSocketConfig
Implementations§
Source§impl WSWriter
impl WSWriter
pub fn new( writer: Arc<Mutex<Writer>>, web_socket_config: WebSocketConfig, encoder: Encoder, ) -> Self
Sourcepub async fn close_connection(&mut self) -> Result<(), Error>
pub async fn close_connection(&mut self) -> Result<(), Error>
This function will be used for closing the connection between two instances, mainly it will be used by a client, to request disconnection with a server.It first sends a close frame through the socket, and waits until it receives the confirmation in a channel executing it inside a timeout, to avoid a long waiting time
pub async fn send_message(&mut self, message: Message) -> Result<(), Error>
pub async fn send(&mut self, data: Vec<u8>) -> Result<(), Error>
pub async fn send_as_binary(&mut self, data: Vec<u8>) -> Result<(), Error>
pub async fn send_as_text(&mut self, data: String) -> Result<(), Error>
pub async fn send_ping(&mut self) -> Result<(), Error>
pub async fn send_large_data_fragmented( &mut self, data: Vec<u8>, fragment_size: usize, ) -> Result<(), Error>
Auto Trait Implementations§
impl Freeze for WSWriter
impl !RefUnwindSafe for WSWriter
impl Send for WSWriter
impl Sync for WSWriter
impl Unpin for WSWriter
impl !UnwindSafe for WSWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more