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.
33 lines
871 B
33 lines
871 B
using Microsoft.AspNetCore.SignalR.Client;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace learun.util
|
|
{
|
|
/// <summary>
|
|
/// 版 本 EasyCode EC管理后台
|
|
/// Copyright (c) 2019-present EC管理有限公司
|
|
/// 创建人:tobin
|
|
/// 日 期:2019.11.05
|
|
/// 描 述:发送消息给SignalR集结器
|
|
/// </summary>
|
|
public static class SendHubs
|
|
{
|
|
/// <summary>
|
|
/// 调用hub方法
|
|
/// </summary>
|
|
/// <param name="methodName"></param>
|
|
/// <param name="args">参数</param>
|
|
public static async Task callMethod(string methodName, params object[] args)
|
|
{
|
|
if (ConfigHelper.GetConfig().IMOpen)
|
|
{
|
|
var connection = new HubConnectionBuilder()
|
|
.WithUrl(ConfigHelper.GetConfig().IMUrl + "/ChatsHub")
|
|
.Build();
|
|
await connection.StartAsync();
|
|
await connection.InvokeAsync(methodName, args);
|
|
await connection.StopAsync();
|
|
}
|
|
}
|
|
}
|
|
}
|