diff --git a/src/Microsoft.AspNetCore.SignalR/Hub.cs b/src/Microsoft.AspNetCore.SignalR/Hub.cs index 74b20d280f..919c2d34e5 100644 --- a/src/Microsoft.AspNetCore.SignalR/Hub.cs +++ b/src/Microsoft.AspNetCore.SignalR/Hub.cs @@ -3,14 +3,19 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.SignalR { - public class Hub : IDisposable + public class Hub : Hub + { + + } + + public class Hub : IDisposable { private bool _disposed; - private IHubConnectionContext _clients; + private IHubConnectionContext _clients; private HubCallerContext _context; private IGroupManager _groups; - public IHubConnectionContext Clients + public IHubConnectionContext Clients { get { diff --git a/src/Microsoft.AspNetCore.SignalR/HubCallerContext.cs b/src/Microsoft.AspNetCore.SignalR/HubCallerContext.cs index 6afc486f00..cf32750ec6 100644 --- a/src/Microsoft.AspNetCore.SignalR/HubCallerContext.cs +++ b/src/Microsoft.AspNetCore.SignalR/HubCallerContext.cs @@ -7,15 +7,13 @@ namespace Microsoft.AspNetCore.SignalR { public HubCallerContext(Connection connection) { - ConnectionId = connection.ConnectionId; - User = connection.User; Connection = connection; } public Connection Connection { get; } - public ClaimsPrincipal User { get; } + public ClaimsPrincipal User => Connection.User; - public string ConnectionId { get; } + public string ConnectionId => Connection.ConnectionId; } } diff --git a/src/Microsoft.AspNetCore.SignalR/HubContext.cs b/src/Microsoft.AspNetCore.SignalR/HubContext.cs index 6a30e74391..cfc1a1d0c7 100644 --- a/src/Microsoft.AspNetCore.SignalR/HubContext.cs +++ b/src/Microsoft.AspNetCore.SignalR/HubContext.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.SignalR { - public class HubContext : IHubContext, IHubConnectionContext + public class HubContext : IHubContext, IHubConnectionContext { private readonly HubLifetimeManager _lifetimeManager; private readonly AllClientProxy _all; @@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.SignalR _all = new AllClientProxy(_lifetimeManager); } - public IHubConnectionContext Clients => this; + public IHubConnectionContext Clients => this; public virtual IClientProxy All => _all; diff --git a/src/Microsoft.AspNetCore.SignalR/HubEndPoint.cs b/src/Microsoft.AspNetCore.SignalR/HubEndPoint.cs index e7b7eccce8..bd4ee81586 100644 --- a/src/Microsoft.AspNetCore.SignalR/HubEndPoint.cs +++ b/src/Microsoft.AspNetCore.SignalR/HubEndPoint.cs @@ -10,22 +10,34 @@ using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.SignalR { - public class HubEndPoint : EndPoint where THub : Hub + public class HubEndPoint : HubEndPoint where THub : Hub + { + public HubEndPoint(HubLifetimeManager lifetimeManager, + IHubContext hubContext, + InvocationAdapterRegistry registry, + ILogger> logger, + IServiceScopeFactory serviceScopeFactory) : base(lifetimeManager, hubContext, registry, logger, serviceScopeFactory) + { + + } + } + + public class HubEndPoint : EndPoint where THub : Hub { private readonly Dictionary>> _callbacks = new Dictionary>>(StringComparer.OrdinalIgnoreCase); private readonly Dictionary _paramTypes = new Dictionary(); private readonly HubLifetimeManager _lifetimeManager; - private readonly IHubContext _hubContext; - private readonly ILogger> _logger; + private readonly IHubContext _hubContext; + private readonly ILogger> _logger; private readonly InvocationAdapterRegistry _registry; private readonly IServiceScopeFactory _serviceScopeFactory; public HubEndPoint(HubLifetimeManager lifetimeManager, - IHubContext hubContext, + IHubContext hubContext, InvocationAdapterRegistry registry, - ILogger> logger, + ILogger> logger, IServiceScopeFactory serviceScopeFactory) { _lifetimeManager = lifetimeManager; diff --git a/src/Microsoft.AspNetCore.SignalR/IHubConnectionContext.cs b/src/Microsoft.AspNetCore.SignalR/IHubConnectionContext.cs index 9a7048e52e..a1e0a5d727 100644 --- a/src/Microsoft.AspNetCore.SignalR/IHubConnectionContext.cs +++ b/src/Microsoft.AspNetCore.SignalR/IHubConnectionContext.cs @@ -1,13 +1,13 @@ namespace Microsoft.AspNetCore.SignalR { - public interface IHubConnectionContext + public interface IHubConnectionContext { - IClientProxy All { get; } + TClient All { get; } - IClientProxy Client(string connectionId); + TClient Client(string connectionId); - IClientProxy Group(string groupName); + TClient Group(string groupName); - IClientProxy User(string userId); + TClient User(string userId); } } diff --git a/src/Microsoft.AspNetCore.SignalR/IHubContext.cs b/src/Microsoft.AspNetCore.SignalR/IHubContext.cs index 0c9f3f62a1..3bfed5f105 100644 --- a/src/Microsoft.AspNetCore.SignalR/IHubContext.cs +++ b/src/Microsoft.AspNetCore.SignalR/IHubContext.cs @@ -5,8 +5,12 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.SignalR { - public interface IHubContext + public interface IHubContext + { + IHubConnectionContext Clients { get; } + } + + public interface IHubContext : IHubContext { - IHubConnectionContext Clients { get; } } }