using Microsoft.AspNetCore.SignalR;
using System.Threading.Tasks;

namespace OnlineSalesAutoCrop.CoreAPI.SignalRHub
{
	/// <summary>
	/// 
	/// </summary>
	public class NotificationHub : Hub<INotificationHub>
	{
		/// <summary>
		/// 
		/// </summary>
		/// <param name="userId"></param>
		/// <param name="msgType"></param>
		/// <param name="itemId"></param>
		/// <param name="ipAddress"></param>
		/// <returns></returns>
		public async Task NotifySubscriber(int userId, int msgType, int itemId, string ipAddress)
		{
			try
			{
				await Clients.All.NotifySubscriber(userId: userId, msgType: msgType, itemId: itemId, ipAddress: ipAddress);
			}
			catch
			{
				//Nothing to do
			}
		}
	}
}
