// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; namespace Microsoft.AspNetCore.SignalR { public class HubContext : IHubContext, IHubClients where THub : Hub { private readonly HubLifetimeManager _lifetimeManager; public HubContext(HubLifetimeManager lifetimeManager) { _lifetimeManager = lifetimeManager; All = new AllClientProxy(_lifetimeManager); Groups = new GroupManager(lifetimeManager); } public IHubClients Clients => this; public virtual IClientProxy All { get; } public virtual IGroupManager Groups { get; } public IClientProxy AllExcept(IReadOnlyList excludedIds) { return new AllClientsExceptProxy(_lifetimeManager, excludedIds); } public virtual IClientProxy Client(string connectionId) { return new SingleClientProxy(_lifetimeManager, connectionId); } public virtual IClientProxy Group(string groupName) { return new GroupProxy(_lifetimeManager, groupName); } public virtual IClientProxy User(string userId) { return new UserProxy(_lifetimeManager, userId); } } }