From 067e9602ba4feccf947a138c9e73462c446268bc Mon Sep 17 00:00:00 2001 From: Jomar Milan Date: Wed, 10 Jun 2026 14:59:07 -0700 Subject: Add syncing of player hand updates to browsers --- src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 9e7f21b..7162402 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ mod session; mod template; use crate::play::handle_play; -use crate::session::{HandObject, Seat, Session}; +use crate::session::{HandObject, PlayUpdate, Seat, Session}; use crate::template::{IndexTemplate, SessionTemplate}; use askama::Template; use axum::extract::{Path, Query, State, WebSocketUpgrade}; @@ -128,10 +128,11 @@ async fn update_hands( for (color, hand) in payload { let seat = session .seats - .entry(color) + .entry(color.to_owned()) .or_insert_with(|| Seat { hand: Vec::new() }); - seat.hand = hand; + seat.hand = hand.to_owned(); + let _ = session.update_tx.send(PlayUpdate::HandUpdate(color, hand)); } StatusCode::NO_CONTENT } -- cgit v1.2.3