UNIVPLMDataIntegration/Admin.NET/Admin.NET.Core/Ai/Interface/ISseChannelManager.cs

26 lines
700 B
C#
Raw Normal View History

2025-06-18 02:06:35 +08:00
// 1. 定义接口
using System.Threading.Channels;
namespace Admin.NET.Core.Ai.Interface;
/// <summary>
/// SSE通道管理接口
/// </summary>
public interface ISseChannelManager
{
/// <summary>
/// 注册
/// </summary>
ChannelReader<string> Register(long userId);
/// <summary>
/// 注销
/// </summary>
/// <param name="userId"></param>
void Unregister(long userId);
/// <summary>
/// 发送消息
/// </summary>
/// <param name="userId"></param>
/// <param name="message"></param>
/// <param name="cancellationToken"></param>
Task SendMessageAsync(long userId, string message, CancellationToken cancellationToken = default);
}