using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace VolPro.Core.SignalR { public class BackgroundMessageService : BackgroundService { private readonly IHubContext _hubContext; private readonly ILogger _logger; private readonly MessageChannel _channel; public BackgroundMessageService( IHubContext hubContext, MessageChannel channel, ILogger logger) { _hubContext = hubContext;; _logger = logger; _channel = channel; } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { await _channel.Run(_hubContext); } } }