This commit is contained in:
Win 2025-02-17 22:18:15 +07:00
parent 98fc180016
commit b1187f118e
2 changed files with 14 additions and 1 deletions

View File

@ -32,13 +32,23 @@ impl ChatRoom {
metadata,
broadcast_tx,
user_registry: UserRegistry::new(),
}
}
}
pub fn get_unique_user_ids(&self) -> Vec<String> {
self.user_registry.get_unique_user_ids()
}
pub async fn store_message(&self) {
let broadcast_tx = self.broadcast_tx.clone();
let mut broadcast_rx = broadcast_tx.subscribe();
let message_data = broadcast_rx.recv().await.unwrap();
println!("{:?}", message_data);
}
/// Add a participant to the room and broadcast that they joined
///
/// # Returns

View File

@ -1,6 +1,7 @@
use anyhow::Context;
use comms::event;
use tokio::sync::broadcast;
use super::chat_room;
#[derive(Debug, Clone)]
pub struct SessionAndUserId {
@ -58,6 +59,8 @@ impl UserSessionHandle {
},
))
.context("could not write to the broadcast channel")?;
chat_room::store_message();
Ok(())
}