net core project. I have azure AD authentication. I have functionality where user will upload files and as soon as file get stored in azure storage I want to notify user through azure signal r. I have implemented this flow but I want to send notification to only that user who uploaded file. Currently If five users are using my application then only one user made file upload then I want to send notification to only that user but not all authenticated users.
public class MapUploadNotificationHub : Hub
{
public override Task OnConnectedAsync()
{
return Clients.Caller.SendAsync("broadcastMessage", "_SYSTEM_", $"{Context.User.Identity.Name} JOINED");
}
public void BroadcastMessage(string message)
{
Clients.Caller.SendAsync("broadcastMessage", message);
}
public void Echo(string message)
{
var echoMessage = $"{message} (echo from server)";
Clients.Client(Context.ConnectionId).SendAsync("echo", echoMessage + " (echo from server)");
}
}
This is my hub class and In below method I am sending notification.
await hub.Clients.All.SendAsync("BroadcastMessage", FileDetails);
When user is uploaded file I want to send notification to only that user and not to everyone who will be using application. This kind of scenarios how It will work I am not able to understand. When web app launches does it establish connection to server with unique connection id or based on the authentication mechanism. I am totally confused. Can someone help me to understand this? Any help would be appreciated. Thank you