This commit is contained in:
Adam 2024-07-21 23:38:59 -04:00
parent a596932aed
commit 61ded634cc

View file

@ -1,7 +1,6 @@
use crate::api::{greeting, Message, User};
use crate::AppState;
use crate::Arc;
use anyhow::Result;
use lib::models::*;
pub async fn message_handler(message: Message, state: &Arc<AppState>, who: &User) {
@ -15,6 +14,7 @@ pub async fn message_handler(message: Message, state: &Arc<AppState>, who: &User
if let Ok(new_game_object) = Game::new(new_game) {
if let Ok(game_json) = serde_json::to_string(&new_game_object) {
tracing::debug!("Sent new game JSON.");
// this is a broadcast
let _ = tx.send(game_json);
} else {
tracing::error!("Failed to convert Game object to JSON.")