sledgemapper/Sledgemapper.Api/Handlers/SendNewWallMessage.cs
Michele Scandura 79edfcc4d3
All checks were successful
continuous-integration/drone/push Build is passing
error message, broken build
2021-09-21 16:53:04 +01:00

22 lines
760 B
C#

using MediatR;
using Microsoft.AspNetCore.SignalR;
using Sledgemapper.Api.Notifications;
using System.Threading;
using System.Threading.Tasks;
using Sledgemapper.Api.Hubs;
using Sledgemapper.Shared.Clients;
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.SessionId.ToString()).NewWall(notification.Wall);
}
}
}