In our application we need to to send push notifications to a random number of clients. We have no way to create static groups for these users until right before sending the message, since the data is classified and can only be seen by the specific user.
We are trying SignalR to provide the notifications but have some doubts what would be the best way to implement the "Send" method.
We would like to know which one of the following options is the most scalable and performant solution for sending around 20 messages/sec to up to 3000 users that are randomly grouped.
Use the Clients method?
The "Clients" method in the API accepts a list of connection ids
Clients.Clients(clientIds).NewMessage(message);
Send the to each client?
Clients.Client(clientId).NewMessage(message);
Dynamically creating Groups?
We can create groups immediately before we send.
var groupName = Guid.NewGuid().ToString();
foreach (var clientId in clientIds)
{
await Groups.Add(clientId, groupName);
}
Clients.Group(groupName).NewMessage(message);
- Is there a way to know if a message was delivered to all the clients that belong to the group? After sending a message to the group we would like/need to delete the group since it will be valid only one time.
Thank you.