Files
Cleanuparr/code/Infrastructure/Health/HealthStatusHub.cs
Flaminel f2027f77a9 #12
2025-05-16 19:16:32 +03:00

39 lines
1.1 KiB
C#

using Microsoft.AspNetCore.SignalR;
namespace Infrastructure.Health;
/// <summary>
/// SignalR hub for broadcasting health status updates
/// </summary>
public class HealthStatusHub : Hub
{
private readonly ILogger<HealthStatusHub> _logger;
/// <summary>
/// Initializes a new instance of the <see cref="HealthStatusHub"/> class
/// </summary>
/// <param name="logger">The logger</param>
public HealthStatusHub(ILogger<HealthStatusHub> logger)
{
_logger = logger;
}
/// <summary>
/// Called when a client connects to the hub
/// </summary>
public override async Task OnConnectedAsync()
{
_logger.LogInformation("Client connected: {connectionId}", Context.ConnectionId);
await base.OnConnectedAsync();
}
/// <summary>
/// Called when a client disconnects from the hub
/// </summary>
public override async Task OnDisconnectedAsync(Exception? exception)
{
_logger.LogInformation("Client disconnected: {connectionId}", Context.ConnectionId);
await base.OnDisconnectedAsync(exception);
}
}