sledgemapper/Sledgemapper.Api/Handlers/SendDeleteWallMessage.cs
Michele Scandura 7e3e645fc9
All checks were successful
continuous-integration/drone/push Build is passing
fixes and cleanup
2021-09-21 11:09:26 +01:00

22 lines
768 B
C#

using MediatR;
using Microsoft.AspNetCore.SignalR;
using Sledgemapper.Api.Notifications;
using Sledgemapper.Clients;
using System.Threading;
using System.Threading.Tasks;
using Sledgemapper.Api.Hubs;
namespace Sledgemapper.Api.Handlers
{
public class SendDeleteWallMessage : INotificationHandler<DeleteWallNotification>
{
private readonly IHubContext<SledgemapperHub, ISledgemapperClient> _hub;
public SendDeleteWallMessage(IHubContext<SledgemapperHub, ISledgemapperClient> hub) => _hub = hub;
public async Task Handle(DeleteWallNotification notification, CancellationToken cancellationToken)
{
await _hub.Clients.Groups(notification.Session.SessionId.ToString()).DeleteWall(notification.Wall);
}
}
}