I have a chat application in which I can send message in real time. I use Django channels for websocket connection.
Here is how it works: Let's say user1 is sending a message and five more people will see the message right away. This is because all the users are in the same room room_group_name which is added to the channel:
await self.channel_layer.group_add(
self.room_group_name, self.channel_name
)
and then as the result message is sent to them:
await self.channel_layer.group_send(
self.room_group_name,
{
"type": "chat_message",
"text": json.dumps(myresponse),
})
Now here is a scenario where I stuck:
when I send a message to chatroom#1 not only I want to update chtroom#1 (which I can), but also users in other chatrooms, need to be notified that chatroon#1 has 1 message.
as an example user one is member of chatroom#1 and chatroom#2. While he is active in chatroom#2, chatroom#1 receives some messages. currently there is no way for this user to be notified because according to above settings only one chatroom self.room_group_name is receiving update.
I wonder how should I add different rooms to my channel, so both chatroom#1 and #2 will be notified:
any hint is appreciated
Thanks,