summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJomar Milan <jomarm@jomarm.com>2026-06-10 14:59:07 -0700
committerJomar Milan <jomarm@jomarm.com>2026-06-10 14:59:07 -0700
commit067e9602ba4feccf947a138c9e73462c446268bc (patch)
tree7f9320d3d6bbe735d1bee519109c24661353eabd /src/main.rs
parent13374b7928788e8cdc6c7905209bafdf943dc02e (diff)
Add syncing of player hand updates to browsers
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs7
1 files changed, 4 insertions, 3 deletions
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
}