Reputation: 373
I have a list of userDetails connected to a hub
and I am storing those users to List<UserDetails>
.I want to add some of the users to a Group
and broadcast a message to that group.
But I am not able to figure out how can I create a group.This is what I a have done so far:
foreach(var user in userDetails)
{
Groups.Add(user.connectionId, "Connected");
}
Clients.Group("Connected").broadcastMessage(message);
Upvotes: 6
Views: 3540
Reputation: 1171
when ever you add a user to a group, if that group doesn't exist already it will be created for you, you don't need to create it specifically.
Upvotes: 11