山东雷驰
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
1.0 KiB

using Kean.Application.Command.Interfaces;
using Kean.Application.Query.Interfaces;
using Kean.Application.Query.Sockets;
using Kean.Infrastructure.SignalR;
using Microsoft.AspNetCore.Http.Connections.Features;
using Microsoft.AspNetCore.SignalR;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Kean.Presentation.Rest.Hubs
{
/// <summary>
/// 消息集线器
/// </summary>
[Route("signalr/statistics")]
public sealed class StatisticsHub : Hub, IOnlineSocket
{
private readonly IHubContext<StatisticsHub> _hub; // 集线器
/// <summary>
/// 依赖注入
/// </summary>
public StatisticsHub(
IHubContext<StatisticsHub> hub)
{
_hub = hub;
}
/*
* 实现 Kean.Application.Query.Sockets.IOnlineSocket.Statistics() 方法
*/
public Task Statistics(object data)
{
return _hub.Clients.All.SendAsync("statistics", data);
}
}
}