This commit is contained in:
Adam 2024-05-03 19:03:24 -04:00
parent 10a72d3e4b
commit de67f31ba3

View file

@ -58,10 +58,12 @@ pub async fn websocket(stream: WebSocket, state: Arc<AppState>) {
match message { match message {
Message::Text(text) => { Message::Text(text) => {
tracing::debug!("Text: {}", text); tracing::debug!("Text: {}", text);
if let Ok(new_game) = serde_json::from_str::<NewGameRequest>(&text) { if let Ok(new_game) = serde_json::from_str::<NewGameRequest>(&text) {
tracing::debug!("{:#?}", new_game); tracing::debug!("{:#?}", new_game);
} else { } else {
tracing::debug!("Not JSON!"); // just echo
let _res = sender.send(Message::Text(text)).await;
} }
} }
Message::Binary(data) => { Message::Binary(data) => {