Answer the question
In order to leave comments, you need to log in
How to handle events for chat in C#?
I want to implement chat rooms, and let's say, in room 5 and someone writes to room 5, then generate an event and send it to all users of the room. That is, do not send it to everyone, and then check if he is in the room, but send it directly to the room. More precisely, if user 1 is in room 5, then he subscribes to the event of receiving a new message, but not for everyone, but for room 5.
How can I implement this?
Thanks
Answer the question
In order to leave comments, you need to log in
This is already implemented, you can use Google Cloud Pub/Sub
Where message - Message
Room - topic
User - subscriber
In general, this is done on the server side, not on the client side.
You can do it like this: Dictionary<Room, User[]>
And send received messages only to those who are in this room.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question