stuff
This commit is contained in:
parent
98fc180016
commit
b1187f118e
|
@ -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
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue