2021-04-08 17:54:02 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.SignalR;
|
2021-04-09 17:59:07 +05:00
|
|
|
|
using System.Collections.Generic;
|
2021-04-08 17:54:02 +05:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2021-04-09 17:59:07 +05:00
|
|
|
|
namespace AsbCloudWebApi.SignalR
|
2021-04-08 17:54:02 +05:00
|
|
|
|
{
|
2021-04-09 17:59:07 +05:00
|
|
|
|
// SignalR manual:
|
|
|
|
|
// https://docs.microsoft.com/ru-ru/aspnet/core/signalr/introduction?view=aspnetcore-5.0
|
2021-04-08 17:54:02 +05:00
|
|
|
|
|
|
|
|
|
[Authorize]
|
2021-09-17 16:24:01 +05:00
|
|
|
|
public class TelemetryHub : Hub
|
2021-04-08 17:54:02 +05:00
|
|
|
|
{
|
|
|
|
|
public Task AddToGroup(string groupName)
|
|
|
|
|
=> Groups.AddToGroupAsync(Context.ConnectionId, groupName.ToString());
|
|
|
|
|
|
|
|
|
|
public Task RemoveFromGroup(string groupName)
|
|
|
|
|
=> Groups.RemoveFromGroupAsync(Context.ConnectionId, groupName);
|
|
|
|
|
}
|
|
|
|
|
}
|