Exemplo n.º 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);
 }
Exemplo n.º 2
0
 public override Task OnDisconnectedAsync(Exception exception)
 {
     SingalrConnection.Remove(Context.ConnectionId);
     return(base.OnDisconnectedAsync(exception));
 }
Exemplo n.º 3
0
        public void SetConnectionMaps(string account)
        {
            string connectionid = Context.ConnectionId;

            SingalrConnection.SetConnectionMaps(connectionid, account);
        }