1 type derived from HubConnectionContext
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
parent\parent\parent\common\testassets\Tests.Utils\HubConnectionContextUtils.cs (1)
42
public class MockHubConnectionContext :
HubConnectionContext
2 instantiations of HubConnectionContext
Microsoft.AspNetCore.SignalR.Core (1)
HubConnectionHandler.cs (1)
139
var connectionContext = new
HubConnectionContext
(connection, contextOptions, _loggerFactory)
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
parent\parent\parent\common\testassets\Tests.Utils\HubConnectionContextUtils.cs (1)
24
return new
HubConnectionContext
(connection, contextOptions, NullLoggerFactory.Instance)
158 references to HubConnectionContext
Microsoft.AspNetCore.SignalR (1)
GetHttpContextExtensions.cs (1)
30
public static HttpContext? GetHttpContext(this
HubConnectionContext
connection)
Microsoft.AspNetCore.SignalR.Core (88)
DefaultHubLifetimeManager.cs (11)
39
var
connection = _connections[connectionId];
72
var
connection = _connections[connectionId];
99
private Task SendToAllConnections(string methodName, object?[] args, Func<
HubConnectionContext
, object?, bool>? include, object? state = null, CancellationToken cancellationToken = default)
105
foreach (
var
connection in _connections)
147
private static void SendToGroupConnections(string methodName, object?[] args, ConcurrentDictionary<string,
HubConnectionContext
> connections, Func<
HubConnectionContext
, object?, bool>? include, object? state, ref List<Task>? tasks, ref SerializedHubMessage? message, CancellationToken cancellationToken)
187
var
connection = _connections[connectionId];
292
public override Task OnConnectedAsync(
HubConnectionContext
connection)
299
public override Task OnDisconnectedAsync(
HubConnectionContext
connection)
341
var
connection = _connections[connectionId];
394
var
connection = _connections[connectionId];
DefaultUserIdProvider.cs (2)
10
/// This provider gets the user ID from the connection's <see cref="
HubConnectionContext
.User"/> name identifier claim.
15
public virtual string? GetUserId(
HubConnectionContext
connection)
HubConnectionContext.cs (13)
88
/// Initializes a new instance of the <see cref="
HubConnectionContext
"/> class.
103
_logger = loggerFactory.CreateLogger(typeof(
HubConnectionContext
));
105
_closedRegistration = connectionContext.ConnectionClosed.Register(static (state) => ((
HubConnectionContext
)state!).Abort(), this);
110
_closedRequestedRegistration = lifetimeNotification.ConnectionClosedRequested.Register(static (state) => ((
HubConnectionContext
)state!).AbortAllowReconnect(), this);
249
public UserIdProviderUserState(
HubConnectionContext
connection, ClaimsPrincipal user)
255
public
HubConnectionContext
Connection { get; }
384
static async ValueTask<FlushResult> WriteAsync(MessageBuffer messageBuffer,
HubConnectionContext
hubConnectionContext,
431
static async ValueTask<FlushResult> WriteAsync(MessageBuffer messageBuffer,
HubConnectionContext
hubConnectionContext,
730
Features.Get<IConnectionHeartbeatFeature>()?.OnHeartbeat(state => ((
HubConnectionContext
)state).KeepAliveTick(), this);
847
Features.Get<IConnectionHeartbeatFeature>()?.OnHeartbeat(state => ((
HubConnectionContext
)state).CheckClientTimeout(), this);
875
var
connection = (
HubConnectionContext
)state!;
890
static async Task InnerAbortConnection(
HubConnectionContext
connection)
HubConnectionContextOptions.cs (1)
7
/// Options used to configure <see cref="
HubConnectionContext
"/>.
HubConnectionHandler.cs (10)
139
var
connectionContext = new HubConnectionContext(connection, contextOptions, _loggerFactory)
200
private Task<bool> OnAuthenticationRefreshAsync(
HubConnectionContext
connection, AuthenticationRefreshContext context)
318
private void OnAuthenticationRefreshed(
HubConnectionContext
connection, ClaimsPrincipal user, SemaphoreSlim authenticationRefreshLock)
324
private async Task HandleUserRefreshedAsync(
HubConnectionContext
connection, ClaimsPrincipal user, SemaphoreSlim authenticationRefreshLock)
374
HubConnectionContext
connection,
379
public
HubConnectionContext
Connection { get; } = connection;
384
private async Task RunHubAsync(
HubConnectionContext
connection)
423
private async Task HubOnDisconnectedAsync(
HubConnectionContext
connection, Exception? exception)
462
private async Task SendCloseAsync(
HubConnectionContext
connection, Exception? exception, bool allowReconnect)
486
private async Task DispatchMessagesAsync(
HubConnectionContext
connection)
HubConnectionStore.cs (13)
10
/// Stores <see cref="
HubConnectionContext
"/>s by ID.
17
private readonly ConcurrentDictionary<string,
HubConnectionContext
> _connections =
18
new ConcurrentDictionary<string,
HubConnectionContext
>(StringComparer.Ordinal);
21
/// Get the <see cref="
HubConnectionContext
"/> by connection ID.
25
public
HubConnectionContext
? this[string connectionId]
29
_connections.TryGetValue(connectionId, out
var
connection);
40
/// Add a <see cref="
HubConnectionContext
"/> to the store.
43
public void Add(
HubConnectionContext
connection)
49
/// Removes a <see cref="
HubConnectionContext
"/> from the store.
52
public void Remove(
HubConnectionContext
connection)
69
public readonly struct Enumerator : IEnumerator<
HubConnectionContext
>
71
private readonly IEnumerator<KeyValuePair<string,
HubConnectionContext
>> _enumerator;
85
public
HubConnectionContext
Current => _enumerator.Current.Value;
HubLifetimeManager.cs (2)
20
public abstract Task OnConnectedAsync(
HubConnectionContext
connection);
28
public abstract Task OnDisconnectedAsync(
HubConnectionContext
connection);
Internal\DefaultHubCallerContext.cs (2)
14
private readonly
HubConnectionContext
_connection;
17
public DefaultHubCallerContext(
HubConnectionContext
connection, ClaimsPrincipal user)
Internal\DefaultHubDispatcher.cs (18)
90
public override async Task OnConnectedAsync(
HubConnectionContext
connection)
127
public override async Task OnDisconnectedAsync(
HubConnectionContext
connection, Exception? exception)
163
public override Task OnAuthenticationRefreshedAsync(
HubConnectionContext
connection)
174
private async Task<bool> InvokeOnAuthenticationRefreshedAsync(
HubConnectionContext
connection)
206
public override Task DispatchMessageAsync(
HubConnectionContext
connection, HubMessage hubMessage)
297
private Task ProcessInvocationBindingFailure(
HubConnectionContext
connection, InvocationBindingFailureMessage bindingFailureMessage)
306
private Task ProcessStreamBindingFailure(
HubConnectionContext
connection, StreamBindingFailureMessage bindingFailureMessage)
322
private Task ProcessStreamItem(
HubConnectionContext
connection, StreamItemMessage message)
334
private Task ProcessInvocation(
HubConnectionContext
connection,
370
private async Task<bool> Invoke(HubMethodDescriptor descriptor,
HubConnectionContext
connection,
447
HubConnectionContext
connection,
577
private static ValueTask CleanupInvocation(
HubConnectionContext
connection, HubMethodInvocationMessage hubMessage, long? streamOwner, IHubActivator<THub>? hubActivator,
596
private async Task StreamAsync(string invocationId,
HubConnectionContext
connection, HubCallerContext hubCallerContext, object?[] arguments, AsyncServiceScope scope,
742
private static async Task SendInvocationError(string? invocationId,
HubConnectionContext
connection, string errorMessage)
754
HubConnectionContext
connection,
818
HubMethodInvocationMessage hubMethodInvocationMessage,
HubConnectionContext
connection)
846
HubConnectionContext
connection, AsyncServiceScope scope, ref object?[] arguments,
974
private static Activity? StartActivity(string operationName, ActivityKind kind, IEnumerable<ActivityLink>? links, IServiceProvider serviceProvider, string methodName, IDictionary<string, string>? headers, ILogger logger,
HubConnectionContext
? connection = null, HubMethodDescriptor? descriptor = null)
Internal\HubConnectionBinder.cs (2)
11
private readonly
HubConnectionContext
_connection;
14
public HubConnectionBinder(HubDispatcher<THub> dispatcher, HubLifetimeManager<THub> lifetimeManager,
HubConnectionContext
connection)
Internal\HubDispatcher.cs (4)
11
public abstract Task OnConnectedAsync(
HubConnectionContext
connection);
12
public abstract Task OnDisconnectedAsync(
HubConnectionContext
connection, Exception? exception);
13
public abstract Task OnAuthenticationRefreshedAsync(
HubConnectionContext
connection);
14
public abstract Task DispatchMessageAsync(
HubConnectionContext
connection, HubMessage hubMessage);
Internal\HubGroupList.cs (9)
9
internal sealed class HubGroupList : IReadOnlyCollection<ConcurrentDictionary<string,
HubConnectionContext
>>
16
public ConcurrentDictionary<string,
HubConnectionContext
>? this[string groupName]
25
public void Add(
HubConnectionContext
connection, string groupName)
34
if (connections.TryRemove(connectionId, out
var
_) && connections.IsEmpty)
47
public IEnumerator<ConcurrentDictionary<string,
HubConnectionContext
>> GetEnumerator()
57
private void CreateOrUpdateGroupWithConnection(string groupName,
HubConnectionContext
connection)
66
HubConnectionContext
connection, GroupConnectionList group)
73
internal sealed class GroupConnectionList : ConcurrentDictionary<string,
HubConnectionContext
>
84
if (obj is ConcurrentDictionary<string,
HubConnectionContext
> list)
IUserIdProvider.cs (1)
17
string? GetUserId(
HubConnectionContext
connection);
Microsoft.AspNetCore.SignalR.Specification.Tests (46)
HubLifetimeManagerTestBase.cs (18)
40
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
41
var
connection2 = HubConnectionContextUtils.Create(client2.Connection);
71
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
72
var
connection2 = HubConnectionContextUtils.Create(client2.Connection);
101
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
102
var
connection2 = HubConnectionContextUtils.Create(client2.Connection);
131
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
132
var
connection2 = HubConnectionContextUtils.Create(client2.Connection);
161
var
connection = HubConnectionContextUtils.Create(client.Connection);
185
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
212
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
240
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
241
var
connection2 = HubConnectionContextUtils.Create(client2.Connection);
275
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
296
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
297
var
connection2 = HubConnectionContextUtils.Create(client2.Connection);
328
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
353
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
parent\parent\parent\common\testassets\Tests.Utils\HubConnectionContextUtils.cs (1)
17
public static
HubConnectionContext
Create(ConnectionContext connection, IHubProtocol protocol = null, string userIdentifier = null)
ScaleoutHubLifetimeManagerTests.cs (27)
52
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
53
var
connection2 = HubConnectionContextUtils.Create(client2.Connection);
79
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
80
var
connection2 = HubConnectionContextUtils.Create(client2.Connection);
109
var
connection = HubConnectionContextUtils.Create(client.Connection);
133
var
connection = HubConnectionContextUtils.Create(client.Connection);
157
var
connection = HubConnectionContextUtils.Create(client.Connection);
183
var
connection = HubConnectionContextUtils.Create(client.Connection);
204
var
connection = HubConnectionContextUtils.Create(client.Connection);
225
var
connection = HubConnectionContextUtils.Create(client.Connection);
249
var
connection = HubConnectionContextUtils.Create(client.Connection);
276
var
connection = HubConnectionContextUtils.Create(client.Connection);
303
var
connection = HubConnectionContextUtils.Create(client.Connection);
334
var
connection = HubConnectionContextUtils.Create(client.Connection);
388
var
connection2 = HubConnectionContextUtils.Create(client2.Connection);
420
var
connection1 = HubConnectionContextUtils.Create(client1.Connection, userIdentifier: "userA");
421
var
connection2 = HubConnectionContextUtils.Create(client2.Connection, userIdentifier: "userA");
422
var
connection3 = HubConnectionContextUtils.Create(client3.Connection, userIdentifier: "userB");
448
var
connection1 = HubConnectionContextUtils.Create(client1.Connection, userIdentifier: "userA");
449
var
connection2 = HubConnectionContextUtils.Create(client2.Connection, userIdentifier: "userA");
450
var
connection3 = HubConnectionContextUtils.Create(client3.Connection, userIdentifier: "userB");
480
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
511
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
542
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
564
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
593
var
connection = HubConnectionContextUtils.Create(client.Connection);
643
var
connection1 = HubConnectionContextUtils.Create(client1.Connection);
Microsoft.AspNetCore.SignalR.StackExchangeRedis (23)
Internal\RedisSubscriptionManager.cs (7)
16
public async Task AddGroupSubscriptionAsync(string channelName, string groupName,
HubConnectionContext
connection, Func<string, HubConnectionStore, Task> subscribeMethod)
54
public async Task AddSubscriptionAsync(string channelName,
HubConnectionContext
connection, Func<string, HubConnectionStore, Task> subscribeMethod)
67
public async Task RemoveGroupSubscriptionAsync(string channelName, string groupName,
HubConnectionContext
connection, object state, Func<object, string, Task> unsubscribeMethod)
88
public async Task<string[]> SetConnectionDisconnectedAndGetGroupNamesAsync(
HubConnectionContext
connection)
103
public async Task RemoveSubscriptionAsync(string channelName,
HubConnectionContext
connection, object state, Func<object, string, Task> unsubscribeMethod)
116
private async Task<bool> AddSubscriptionAsyncCore(string id,
HubConnectionContext
connection, Func<string, HubConnectionStore, Task> subscribeMethod)
153
private async Task RemoveSubscriptionAsyncCore(string id,
HubConnectionContext
connection, object state, Func<object, string, Task> unsubscribeMethod)
RedisHubLifetimeManager.cs (16)
89
public override async Task OnConnectedAsync(
HubConnectionContext
connection)
111
public override async Task OnDisconnectedAsync(
HubConnectionContext
connection)
164
var
connection = _connections[connectionId];
205
var
connection = _connections[connectionId];
221
var
connection = _connections[connectionId];
293
private Task AddGroupAsyncCore(
HubConnectionContext
connection, string groupName)
300
/// This takes <see cref="
HubConnectionContext
"/> because we want to remove the connection from the
303
private async Task RemoveGroupAsyncCore(
HubConnectionContext
connection, string groupName)
326
private Task RemoveUserAsync(
HubConnectionContext
connection, string userIdentifier)
354
var
connection = _connections[connectionId];
432
foreach (
var
connection in _connections)
458
var
connection = _connections[groupMessage.ConnectionId];
497
private async Task SubscribeToConnection(
HubConnectionContext
connection)
552
private Task SubscribeToUser(
HubConnectionContext
connection, string userIdentifier)
567
foreach (
var
userConnection in subscriptions)
593
foreach (
var
groupConnection in groupConnections)