Moved all services from API to BLL project
This commit is contained in:
31
Birdmap.BLL/Services/CommunationServices/Hubs/DevicesHub.cs
Normal file
31
Birdmap.BLL/Services/CommunationServices/Hubs/DevicesHub.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Birdmap.BLL.Services.CommunicationServices.Hubs
|
||||
{
|
||||
public class DevicesHub : Hub<IDevicesHubClient>
|
||||
{
|
||||
private readonly ILogger<DevicesHub> _logger;
|
||||
|
||||
public DevicesHub(ILogger<DevicesHub> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public override Task OnConnectedAsync()
|
||||
{
|
||||
_logger.LogInformation("Devices Hub Client connected.");
|
||||
|
||||
return base.OnConnectedAsync();
|
||||
}
|
||||
|
||||
public override Task OnDisconnectedAsync(Exception exception)
|
||||
{
|
||||
_logger.LogInformation("Devices Hub Client disconnected.");
|
||||
|
||||
return base.OnDisconnectedAsync(exception);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Birdmap.BLL.Services.CommunicationServices.Hubs
|
||||
{
|
||||
public record Message(Guid DeviceId, DateTime Date, double Probability);
|
||||
|
||||
public interface IDevicesHubClient
|
||||
{
|
||||
Task NotifyMessagesAsync(IEnumerable<Message> messages);
|
||||
Task NotifyDeviceUpdatedAsync(Guid deviceId);
|
||||
Task NotifyAllUpdatedAsync();
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Birdmap.BLL.Services.CommunicationServices.Hubs
|
||||
{
|
||||
public interface IServicesHubClient
|
||||
{
|
||||
Task NotifyUpdatedAsync();
|
||||
}
|
||||
}
|
31
Birdmap.BLL/Services/CommunationServices/Hubs/ServicesHub.cs
Normal file
31
Birdmap.BLL/Services/CommunationServices/Hubs/ServicesHub.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Birdmap.BLL.Services.CommunicationServices.Hubs
|
||||
{
|
||||
public class ServicesHub : Hub<IServicesHubClient>
|
||||
{
|
||||
private readonly ILogger<ServicesHub> _logger;
|
||||
|
||||
public ServicesHub(ILogger<ServicesHub> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public override Task OnConnectedAsync()
|
||||
{
|
||||
_logger.LogInformation("Services Hub Client connected.");
|
||||
|
||||
return base.OnConnectedAsync();
|
||||
}
|
||||
|
||||
public override Task OnDisconnectedAsync(Exception exception)
|
||||
{
|
||||
_logger.LogInformation("Services Hub Client disconnected.");
|
||||
|
||||
return base.OnDisconnectedAsync(exception);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user