async fn send_message_to_web_socket(&self, message: Messages) {
        let msg_state_id = message.get_state_id();
        let sockets = &*self.sockets.lock().await;
        for (websocket, state_id) in sockets {
            if msg_state_id == *state_id {
                if let Some(message) = WSMessages::from_message(&message) {
                    let sent_message = websocket.lock().await.send(message).await;
                    match sent_message {
                        Ok(_) => {}
                        Err(_err) => {
                            // Handle error
                        }
                    }
                }
            }
        }
    }
/// Easily send a message to all websockets in it's state ID
Easily send a message to all websockets in it's state ID
Easily send a message to all websockets in it ' s state ID
async fn send_message_to_web_socket(&self, message: Messages) {
        let msg_state_id = message.get_state_id();
        let sockets = &*self.sockets.lock().await;
        for (websocket, state_id) in sockets {
            if msg_state_id == *state_id {
                if let Some(message) = WSMessages::from_message(&message) {
                    let sent_message = websocket.lock().await.send(message).await;
                    match sent_message {
                        Ok(_) => {}
                        Err(_err) => {
                            // Handle error
                        }
                    }
                }
            }
        }
    }
async fn send_message_to_web_socket ( & self , message : Messages ) { let msg_state_id = message . get_state_id ( ) ; let sockets = & * self . sockets . lock ( ) . await ; for ( websocket , state_id ) in sockets { if msg_state_id == * state_id { if let Some ( message ) = WSMessages :: from_message ( & message ) { let sent_message = websocket . lock ( ) . await . send ( message ) . await ; match sent_message { Ok ( _ ) => { } Err ( _err ) => { // Handle error } } } } } }
Easily send a message to all websockets in it's state ID
Easily send a message to all websockets in it ' s state ID
&self
message
Messages