2018-04-13 13:45:21 +02:00
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
|
using System;
|
2018-04-19 00:58:09 +02:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2018-04-13 13:45:21 +02:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2018-04-19 00:58:09 +02:00
|
|
|
|
namespace Ordering.SignalrHub
|
2018-04-13 13:45:21 +02:00
|
|
|
|
{
|
|
|
|
|
[Authorize]
|
|
|
|
|
public class NotificationsHub : Hub
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public override async Task OnConnectedAsync()
|
|
|
|
|
{
|
2018-05-15 12:42:08 +02:00
|
|
|
|
await Groups.AddToGroupAsync(Context.ConnectionId, Context.User.Identity.Name);
|
2018-04-13 13:45:21 +02:00
|
|
|
|
await base.OnConnectedAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override async Task OnDisconnectedAsync(Exception ex)
|
|
|
|
|
{
|
2018-05-15 12:42:08 +02:00
|
|
|
|
await Groups.AddToGroupAsync(Context.ConnectionId, Context.User.Identity.Name);
|
2018-04-13 13:45:21 +02:00
|
|
|
|
await base.OnDisconnectedAsync(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|