update on the server works now

This commit is contained in:
Sebastian Moser
2022-10-24 22:29:38 +02:00
parent 202f493eba
commit 2a0a4867f9
3 changed files with 54 additions and 53 deletions

View File

@@ -79,20 +79,26 @@ pub fn run_server(args: Vec<String>) {
//println!("{}", err.message);
//}
println!("TEST");
//println!("TEST");
//testing
let val = "mize.works".to_string().into_bytes();
let mut update: Vec<u8> = Vec::new();
update.push(0);
update.extend(u32::to_be_bytes(3));
update.extend(u32::to_be_bytes(5));
update.extend("$$".to_string().into_bytes());
let new_val = proto::apply_update(&val, &update);
println!("TEST");
println!("TEST: {}", String::from_utf8(new_val).unwrap());
//let val = "mize.works".to_string().into_bytes();
//let mut update: Vec<u8> = Vec::new();
//update.push(2);
//update.extend(u32::to_be_bytes(3));
//update.extend(u32::to_be_bytes(4));
//update.extend("$$".to_string().into_bytes());
//update.push(0);
//update.extend(u32::to_be_bytes(5));
//update.extend(u32::to_be_bytes(7));
//update.extend("$$".to_string().into_bytes());
//let new_val = proto::apply_update(&val, &update);
//println!("TEST");
//println!("TEST: {}", String::from_utf8(new_val).unwrap());
//run the webserver
//warp_server(mize_folder);
warp_server(mize_folder);
}
@@ -187,6 +193,7 @@ async fn handle_socket_connection(
},
Response::All(response) => {
let clients = clients_clone.lock().await;
println!("Clients: {}", clients.len());
for client in &clients[..] {
client.tx.send(Ok(ws::Message::binary(response.clone())));
}