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)); }
public IClientProxy GetProxyById(string userId) { return(_connectionRegistry.Get(userId)); }