32 lines
996 B
C#
32 lines
996 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace FinlyticBackend.Hubs;
|
|
|
|
/// <summary>
|
|
/// SignalR Hub streaming real-time stock prices & daily % growth updates for favorite assets every 10 seconds.
|
|
/// </summary>
|
|
public class FavoritesPriceHub : Hub
|
|
{
|
|
private readonly ILogger<FavoritesPriceHub> _logger;
|
|
|
|
public FavoritesPriceHub(ILogger<FavoritesPriceHub> logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
public override async Task OnConnectedAsync()
|
|
{
|
|
_logger.LogInformation("[FavoritesPriceHub] SignalR client connected: ConnectionId={ConnectionId}", Context.ConnectionId);
|
|
await base.OnConnectedAsync();
|
|
}
|
|
|
|
public override async Task OnDisconnectedAsync(Exception? exception)
|
|
{
|
|
_logger.LogInformation("[FavoritesPriceHub] SignalR client disconnected: ConnectionId={ConnectionId}", Context.ConnectionId);
|
|
await base.OnDisconnectedAsync(exception);
|
|
}
|
|
}
|