server: finish port to axum w/ websockets

This commit is contained in:
2025-04-15 13:13:33 -07:00
parent aa1736a285
commit edc7119fbf
7 changed files with 134 additions and 354 deletions

View File

@@ -10,10 +10,11 @@ pub struct ConnectionTracker {
}
impl ConnectionTracker {
pub fn add_peer(&mut self, socket: WebSocket, who: SocketAddr) {
pub async fn add_peer(&mut self, socket: WebSocket, who: SocketAddr) {
warn!("adding {who:?} to connection tracker");
self.peers.insert(who, socket);
self.send_message_all(WebsocketMessage::RefreshMessages);
self.send_message_all(WebsocketMessage::RefreshMessages)
.await;
}
pub async fn send_message_all(&mut self, msg: WebsocketMessage) {
info!("send_message_all {msg}");