sledgemapper/Sledgemapper.Api/Handlers/SendNewOverlayMessage.cs
Michele Scandura af441e772b cleanup
2020-11-18 11:09:26 +00:00

22 lines
749 B
C#

using MediatR;
using Microsoft.AspNetCore.SignalR;
using SignalRChat.Hubs;
using Sledgemapper.Api.Notifications;
using Sledgemapper.Clients;
using System.Threading;
using System.Threading.Tasks;
namespace Sledgemapper.Api.Handlers
{
public class SendNewOverlayMessage : INotificationHandler<NewOverlayNotification>
{
private readonly IHubContext<SledgemapperHub, ISledgemapperClient> _hub;
public SendNewOverlayMessage(IHubContext<SledgemapperHub, ISledgemapperClient> hub) => _hub = hub;
public async Task Handle(NewOverlayNotification notification, CancellationToken cancellationToken)
{
await _hub.Clients.Groups(notification.SessionName).NewOverlay(notification.Overlay);
}
}
}