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(); } public void Notify(string eventName, string entityType, object oldEntity, object newEntity) { var connectionsIds = _connectionTracker.Get(); _hubContext.Clients.Clients(connectionsIds).notify(eventName, entityType, oldEntity, newEntity); } } }