using Microsoft.AspNetCore.SignalR;
using Nop.Plugin.Misc.SignalRApi.Hubs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Nop.Plugin.Misc.SignalRApi.Services
{
    public class SignalRservice
    {
        private readonly IHubContext<MainHub> _hubContext;

        public SignalRservice(IHubContext<MainHub> hubContext)
        {
            _hubContext = hubContext;
        }

        public async Task TestHub()
        {
            // Check if you can access hub context
            await _hubContext.Clients.All.SendAsync("TestMessage", "Hello from server");
        }
    }
}
