using Microsoft.AspNetCore.SignalR;

namespace SafeCampus.Web.Core.Controllers.Application.Business;
/// <summary>
/// 预警消息前端订阅
/// </summary>
public class SubscribeHub:Hub<IChatClient>
{
    // 定义一个方法供客户端调用
    public async Task SendMessage(string user, string message)
    {
        // 触发客户端定义监听的方法
        await Clients.All.ReceiveMessage( user, message);
    }
}

public interface IChatClient
{
    Task ReceiveMessage(string user, string message);
}