message-chat-update

This commit is contained in:
Untone 2023-11-16 17:52:06 +03:00
parent 3fff0f77ee
commit 77420289be
2 changed files with 10 additions and 2 deletions

View File

@ -122,7 +122,10 @@ pub async fn is_fitting(
// TODO: check all authors subscribers
Ok(true)
} else if message_data.entity == "chat" {
// payload is Message or Chat
// payload is Chat
Ok(true)
} else if message_data.entity == "message" {
// payload is Message
Ok(true)
} else if message_data.entity == "follower" {
// payload is Author

View File

@ -86,8 +86,13 @@ async fn connect_handler(
pubsub.subscribe("reaction").await.unwrap();
println!("'reaction' pubsub subscribed");
// chats by member_id
pubsub.subscribe(format!("chat:{}", listener_id)).await.unwrap();
println!("'chat:{}' pubsub subscribed", listener_id);
// messages by chat_id
for chat_id in &chats {
let channel_name = format!("chat:{}", chat_id);
let channel_name = format!("message:{}", chat_id);
pubsub.subscribe(&channel_name).await.unwrap();
println!("'{}' subscribed", channel_name);
}