You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuWebSocketNotificationsBusiness.cs 998B

12345678910111213141516171819202122232425
  1. using Luticate2.Utils.Hubs;
  2. using Luticate2.Utils.Interfaces;
  3. using Microsoft.AspNetCore.SignalR;
  4. using Microsoft.AspNetCore.SignalR.Infrastructure;
  5. namespace Luticate2.Utils.Business
  6. {
  7. public class LuWebSocketNotificationsBusiness : ILuWebSocketNotificationsBusiness
  8. {
  9. private readonly LuHubConnectionTracker _connectionTracker;
  10. private readonly IHubContext _hubContext;
  11. public LuWebSocketNotificationsBusiness(IConnectionManager connectionManager, LuHubConnectionTracker connectionTracker)
  12. {
  13. _connectionTracker = connectionTracker;
  14. _hubContext = connectionManager.GetHubContext<LuNotificationsHub>();
  15. }
  16. public void Notify(string eventName, string entityType, object oldEntity, object newEntity)
  17. {
  18. var connectionsIds = _connectionTracker.Get<LuNotificationsHub>();
  19. _hubContext.Clients.Clients(connectionsIds).notify(eventName, entityType, oldEntity, newEntity);
  20. }
  21. }
  22. }