async fn reply_current_page(sender_id: i64, comic: &str, page: Option<String>) {
    let mut response = json!({ "comic": comic });
    if let Some(page) = page {
        response["page"] = serde_json::Value::String(page);
    }
    let clients = &mut STATUS.lock().await.connections;
    let source_client = clients
        .iter_mut()
        .find(|client| client.id == sender_id)
        .unwrap();
    let response = warp::ws::Message::text(response.to_string());
    log::debug!(
        target: "scr::sharing_service",
        "Sending message: {:?} to user {}",
        response,
        source_client.id
    );
    source_client.socket.send(response).await.unwrap();
}
// When a new client loads in, tell it what the current page is.
When a new client loads in, tell it what the current page is.
When a new client loads in tell it what the current page is .
async fn reply_current_page(sender_id: i64, comic: &str, page: Option<String>) {
    let mut response = json!({ "comic": comic });
    if let Some(page) = page {
        response["page"] = serde_json::Value::String(page);
    }
    let clients = &mut STATUS.lock().await.connections;
    let source_client = clients
        .iter_mut()
        .find(|client| client.id == sender_id)
        .unwrap();
    let response = warp::ws::Message::text(response.to_string());
    log::debug!(
        target: "scr::sharing_service",
        "Sending message: {:?} to user {}",
        response,
        source_client.id
    );
    source_client.socket.send(response).await.unwrap();
}
async fn reply_current_page ( sender_id : i64 , comic : & str , page : Option < String > ) { let mut response = json ! ( { " " comic } ) ; if let Some ( page ) = page { response [ " " ] = serde_json :: Value :: String ( page ) ; } let clients = & mut STATUS . lock ( ) . await . connections ; let source_client = clients . iter_mut ( ) . find ( | client | client . id == sender_id ) . unwrap ( ) ; let response = warp :: ws :: Message :: text ( response . to_string ( ) ) ; log :: debug ! ( target " " " " response source_client id ) ; source_client . socket . send ( response ) . await . unwrap ( ) ; }
When a new client loads in, tell it what the current page is.
When a new client loads in tell it what the current page is .
sender_id
i64
comic
&str
page
Option<String>
sender_id
i64
comic
&str
page
Option<String>