namespace SafeCampus.Plugin.SignalR
{
///
///
///
[Injection(Named = "signalr")]
public class SignalrNoticeService : INoticeService
{
public SignalrNoticeService()
{
}
///
public async Task UpdatePassWord(string userId, List clientIds, string message)
{
//发送消息给用户
await GetHubContext().Clients.Users(clientIds).NewMessage(message);
}
///
public async Task NewMesage(List userIds, List clientIds, string message)
{
//发送消息给用户
await GetHubContext().Clients.Users(clientIds).NewMessage(message);
}
///
public async Task UserLoginOut(string userId, List clientIds, string message)
{
//发送消息给用户
await GetHubContext().Clients.Users(clientIds).LoginOut(message);
}
#region MyRegion
///
/// 获取hubContext
///
///
private IHubContext GetHubContext()
{
//解析服务
var service = App.GetService>();
return service;
}
#endregion MyRegion
}
}