In my asp.net core 3.1 application I am using signalr for sending messages and angular for UI. So for now Everyone can see messages, I would like to send message only for appropriate organizations can see. For ex: I have 2 organizations, org1 and org2. In org1 there are 4 users and in org2 it is 5 users. I would like to send messages for ex: org1 user loggedin and only 4 users should notified. I have getCurrentOrgId as well.
My NotificationHub Class looks like:
public class NotificationHub : Hub
{
public async Task SendMessage(string user, string message)
{
await Clients.All.SendAsync("ReceiveMessage", user, message);
}
}
And I am using HubContext to send message:
private readonly IHubContext<NotificationHub> _hubContext;
await _hubContext.Clients.All.SendAsync("ReceiveMessage",$"{notificationToAdd.ActionMessage}", cancellationToken: cancellationToken);
// I would like some organizationGroup and send messages only loggedinuser orgId == getCurrentOrgId. Only users for appropriate organization can see notification orgId2 users should not see orgId1 users notification.