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

22 lines
739 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 SendNewWallMessage : INotificationHandler<NewWallNotification>
{
private readonly IHubContext<SledgemapperHub, ISledgemapperClient> _hub;
public SendNewWallMessage(IHubContext<SledgemapperHub, ISledgemapperClient> hub) => _hub = hub;
public async Task Handle(NewWallNotification notification, CancellationToken cancellationToken)
{
await _hub.Clients.Groups(notification.Session.SessionName).NewWall(notification.Wall);
}
}
}