hub configurations

This commit is contained in:
Kyle Spearrin
2018-08-16 13:35:16 -04:00
parent 030f85278c
commit 42d3a2d8e3
6 changed files with 30 additions and 18 deletions

View File

@@ -0,0 +1,27 @@
using System.Threading.Tasks;
using Bit.Core.Models;
using Bit.Core.Utilities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
namespace Bit.Hub
{
[Authorize("Internal")]
[SelfHosted(SelfHostedOnly = true)]
public class NotificationsController : Controller
{
private readonly IHubContext<SyncHub> _syncHubContext;
public NotificationsController(IHubContext<SyncHub> syncHubContext)
{
_syncHubContext = syncHubContext;
}
[HttpPost("~/notifications")]
public async Task PostNotification([FromBody]PushNotificationData<object> model)
{
await HubHelpers.SendNotificationToHubAsync(model, _syncHubContext);
}
}
}