using Dpz.Core.Web.Library.Hub;
using JetBrains.Annotations;
using Microsoft.AspNetCore.SignalR;
namespace Dpz.Core.Web.Library.Activator;
/// <summary>
/// 会话通知服务,用于在后台作业完成后通知客户端
/// </summary>
[UsedImplicitly]
public class SessionNotificationService(IHubContext<RobotChatHub> hubContext)
{
/// <summary>
/// 通知用户会话名称已生成
/// </summary>
[UsedImplicitly]
public async Task NotifySessionNameGenerated(string userId, string sessionId)
{
// 通知所有连接到该用户的客户端
await hubContext.Clients.User(userId).SendAsync("SessionNameGenerated", sessionId);
}
}