read loop

This commit is contained in:
2026-08-11 21:02:26 -04:00
parent 0438bade23
commit 180e7ec4ce
2 changed files with 31 additions and 4 deletions
+9 -2
View File
@@ -22,9 +22,16 @@ async fn main() {
async fn ws_handler(ws: WebSocketUpgrade) -> Response {
ws.on_upgrade(|socket: WebSocket| async {
match Client::initialize(socket).await {
Ok(client) => {}
Ok(mut client) => {
if let Err(e) = client.read_loop().await {
eprintln!("Failed to handle client: {e}");
} else {
println!("Client connection closed")
}
}
Err(e) => {
eprintln!("Failed to initialize client {e}")
eprintln!("Failed to initialize client: {e}")
}
}
})