12345678910111213141516171819202122232425 |
- using Luticate2.Utils.Hubs;
- using Luticate2.Utils.Interfaces;
- using Microsoft.AspNetCore.SignalR;
- using Microsoft.AspNetCore.SignalR.Infrastructure;
-
- namespace Luticate2.Utils.Business
- {
- public class LuWebSocketNotificationsBusiness : ILuWebSocketNotificationsBusiness
- {
- private readonly LuHubConnectionTracker _connectionTracker;
- private readonly IHubContext _hubContext;
-
- public LuWebSocketNotificationsBusiness(IConnectionManager connectionManager, LuHubConnectionTracker connectionTracker)
- {
- _connectionTracker = connectionTracker;
- _hubContext = connectionManager.GetHubContext<LuNotificationsHub>();
- }
-
- public void Notify(string eventName, string entityType, object oldEntity, object newEntity)
- {
- var connectionsIds = _connectionTracker.Get<LuNotificationsHub>();
- _hubContext.Clients.Clients(connectionsIds).notify(eventName, entityType, oldEntity, newEntity);
- }
- }
- }
|