Files
painter/crates/application/src/soldiers/disconnect.rs
Gabriel Kaszewski 99f614b7b7
All checks were successful
CI / ci (push) Successful in 5m57s
Add UserId newtype and WebSocket ping keep-alive
Replace raw String user IDs with a UserId newtype in domain for
type safety, and add 30s ping/pong to prevent idle WebSocket
disconnects.
2026-08-18 17:02:19 +02:00

13 lines
319 B
Rust

use domain::{BroadcastEvent, UserId};
use crate::AppState;
pub fn execute(state: &AppState, user_id: &UserId) -> usize {
state.cooldowns().remove(user_id);
let count = state.soldiers().remove(user_id);
state
.broadcaster()
.publish(BroadcastEvent::SoldierCountChanged(count));
count
}