// 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; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Microsoft.AspNetCore.SignalR { public class HubContext : IHubContext, IHubConnectionContext { private readonly HubLifetimeManager _lifetimeManager; private readonly AllClientProxy _all; public HubContext(HubLifetimeManager lifetimeManager) { _lifetimeManager = lifetimeManager; _all = new AllClientProxy(_lifetimeManager); } public IHubConnectionContext Clients => this; public virtual IClientProxy All => _all; 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); } } }