Beispiel #1
0
        public override Task OnDisconnectedAsync(System.Exception exception)
        {
            var connectionId = Context.ConnectionId;
            var userId       = _connectionUserRegistry.Get(connectionId);

            if (!string.IsNullOrEmpty(userId))
            {
                _clientRegistry.Disconnect(userId);
            }
            _connectionUserRegistry.Remove(connectionId);
            Console.WriteLine($"{connectionId} disconnected.");

            return(base.OnDisconnectedAsync(exception));
        }
Beispiel #2
0
 public IClientProxy GetProxyById(string userId)
 {
     return(_connectionRegistry.Get(userId));
 }