using EnotaryoPH.Web.Common.Hubs; using Microsoft.AspNetCore.SignalR; namespace EnotaryoPH.Web.Common.Services { public class NotificationService : INotificationService { private readonly IHubContext _hubContext; public NotificationService(IHubContext hubContext) => _hubContext = hubContext; public async Task NotifyAllAsync(string message) => await _hubContext.Clients.All.SendAsync("ReceiveUserNotification", message); public async Task NotifyUserAsync(string message, string userID) => await NotifyUsersAsync(message, userID); public async Task NotifyUsersAsync(string message, params string[] userIDs) => await _hubContext.Clients.Users(userIDs).SendAsync("ReceiveUserNotification", message); } }