22 lines
638 B
C#
22 lines
638 B
C#
|
|
using Microsoft.AspNetCore.SignalR;
|
|||
|
|
using YD_TrainingCompetition_Api.Hubs;
|
|||
|
|
using YD_TrainingCompetition_Api.Models;
|
|||
|
|
|
|||
|
|
namespace YD_TrainingCompetition_Api.Services;
|
|||
|
|
|
|||
|
|
public sealed class SignalRRealtimeNotifier : IRealtimeNotifier
|
|||
|
|
{
|
|||
|
|
private readonly IHubContext<ScoringHub> _hubContext;
|
|||
|
|
|
|||
|
|
public SignalRRealtimeNotifier(IHubContext<ScoringHub> hubContext)
|
|||
|
|
{
|
|||
|
|
_hubContext = hubContext;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public Task BroadcastTelemetryAsync(DeviceSnapshot snapshot, CancellationToken cancellationToken = default)
|
|||
|
|
{
|
|||
|
|
return _hubContext.Clients.All.SendAsync("telemetry-updated", snapshot, cancellationToken);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|