using System;
using System.Threading.Tasks;
using Dpz.Core.Infrastructure;
namespace Dpz.Core.Web.Library.Hub
{
public class Notification : Microsoft.AspNetCore.SignalR.Hub
{
public Task Init()
{
return Clients.Caller.SendCoreAsync("ready", new object[] { "notification ready" });
}
public async Task GetRunTime()
{
var runTimeCount = DateTime.Now - WebToolsExtensions.StartTime;
var msg =
$"{runTimeCount.Days:00}天{runTimeCount.Hours:00}小时{runTimeCount.Minutes:00}分钟{runTimeCount.Seconds:00}秒";
await Clients.Caller.SendCoreAsync("ReceiveRunTime", new object[] { msg });
}
public async Task SendSystemNotification(string message)
{
await Clients.All.SendCoreAsync("systemNotification", new object[] { message });
}
public async Task PushLogMessage(int level, string message)
{
await Clients.All.SendCoreAsync("pushLogMessage", new object[] { level, message });
}
public async Task PushCnBetaMessage(ProgressMessage message)
{
await Clients.All.SendCoreAsync("cnBetaSubscribe", new object[] { message });
}
}
}