Пример #1
0
 public async Task SendClientMessage(Message message)
 {
     if (string.IsNullOrEmpty(message.Revicer))
     {
         throw new ArgumentNullException("指定的客户端连接为空");
     }
     IReadOnlyList <string> connectionsByUser = SingalrConnection.GetConnectionIds(message.Revicer);
     await _hubContext.Clients.Clients(connectionsByUser).SendAsync("ReviceMesage", message);
 }
Пример #2
0
 public override Task OnDisconnectedAsync(Exception exception)
 {
     SingalrConnection.Remove(Context.ConnectionId);
     return(base.OnDisconnectedAsync(exception));
 }
Пример #3
0
        public void SetConnectionMaps(string account)
        {
            string connectionid = Context.ConnectionId;

            SingalrConnection.SetConnectionMaps(connectionid, account);
        }