diff --git a/0_Framework/Application/AuthHelper.cs b/0_Framework/Application/AuthHelper.cs index 12f820f8..41e6efa2 100644 --- a/0_Framework/Application/AuthHelper.cs +++ b/0_Framework/Application/AuthHelper.cs @@ -199,7 +199,7 @@ public class AuthHelper : IAuthHelper new("WorkshopSlug",slug), new("WorkshopId", account.WorkshopId.ToString()), new("WorkshopName",account.WorkshopName??""), - new("pm.userId", account.PmUserId?.ToString() ?? "0"), + new("pm.userId", account.PmUserId.ToString()), }; diff --git a/ServiceHost/Hubs/ProgramManager/ProjectBoardHub.cs b/ServiceHost/Hubs/ProgramManager/ProjectBoardHub.cs index 7acec847..5c262095 100644 --- a/ServiceHost/Hubs/ProgramManager/ProjectBoardHub.cs +++ b/ServiceHost/Hubs/ProgramManager/ProjectBoardHub.cs @@ -6,8 +6,16 @@ public class ProjectBoardHub:Hub { public override async Task OnConnectedAsync() { - Console.WriteLine($"{Context.ConnectionId} connected"); - await Clients.All.SendAsync("ReceiveGreeting","A new user has connected to the Project Board Hub!"); + var user = Context.User?.FindFirst("pm.userId")?.Value; + + if (user != null && user !="0") + { + await Groups.AddToGroupAsync( + Context.ConnectionId, + $"pm.user-{user}" + ); + } + await base.OnConnectedAsync(); } } \ No newline at end of file diff --git a/ServiceHost/Notifications/ProgramManager/SignalRBoardNotificationPublisher.cs b/ServiceHost/Notifications/ProgramManager/SignalRBoardNotificationPublisher.cs index 5b280f1d..130d8f09 100644 --- a/ServiceHost/Notifications/ProgramManager/SignalRBoardNotificationPublisher.cs +++ b/ServiceHost/Notifications/ProgramManager/SignalRBoardNotificationPublisher.cs @@ -24,7 +24,7 @@ public class SignalRBoardNotificationPublisher:IBoardNotificationPublisher NewStatus = newStatus, SectionId = sectionId }; - _hubContext.Clients.User(userId.ToString()).SendAsync("ReceiveProjectStatusChanged",payload); + _hubContext.Clients.Group($"pm.user-{userId}").SendAsync("ReceiveProjectStatusChanged",payload); return Task.CompletedTask; } } \ No newline at end of file