1 write to Connection
Microsoft.AspNetCore.SignalR.Tests.Utils (1)
TestClient.cs (1)
46Connection = new DefaultConnectionContext(Guid.NewGuid().ToString(), pair.Transport, pair.Application);
94 references to Connection
Microsoft.AspNetCore.SignalR.Microbenchmarks (6)
RedisHubLifetimeManagerBenchmark.cs (6)
51await _manager2.OnConnectedAsync(HubConnectionContextUtils.Create(client.Connection, protocol, userId)); 52await _manager2.AddToGroupAsync(client.Connection.ConnectionId, "Everyone"); 53await _manager2.AddToGroupAsync(client.Connection.ConnectionId, groupName); 70_excludedConnectionIds.Add(_clients[i].Connection.ConnectionId); 76_sendIds.Add(_clients[i].Connection.ConnectionId); 132await _manager1.SendConnectionAsync(_clients[0].Connection.ConnectionId, "Test", _args);
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (4)
RedisHubLifetimeManagerTests.cs (4)
64var connection1 = HubConnectionContextUtils.Create(client1.Connection); 65var connection2 = HubConnectionContextUtils.Create(client2.Connection); 114var connection = HubConnectionContextUtils.Create(client.Connection); 137var connection = HubConnectionContextUtils.Create(client.Connection);
Microsoft.AspNetCore.SignalR.Tests (71)
DefaultHubLifetimeManagerTests.cs (14)
30var connection1 = HubConnectionContextUtils.Create(client1.Connection); 31var connection2 = HubConnectionContextUtils.Create(client2.Connection); 60var connection1 = HubConnectionContextUtils.Create(client1.Connection); 61var connection2 = HubConnectionContextUtils.Create(client2.Connection); 86var connection1 = HubConnectionContextUtils.Create(client1.Connection); 108var connection1 = HubConnectionContextUtils.Create(client1.Connection); 130var connection1 = HubConnectionContextUtils.Create(client1.Connection); 154var connection1 = HubConnectionContextUtils.Create(client1.Connection); 155var connection2 = HubConnectionContextUtils.Create(client2.Connection); 182var connection1 = HubConnectionContextUtils.Create(client1.Connection); 206var connection1 = HubConnectionContextUtils.Create(client1.Connection, userIdentifier: "user"); 207var connection2 = HubConnectionContextUtils.Create(client2.Connection, userIdentifier: "user"); 236var connection1 = HubConnectionContextUtils.Create(client1.Connection, userIdentifier: "user1"); 237var connection2 = HubConnectionContextUtils.Create(client2.Connection, userIdentifier: "user2");
HubConnectionHandlerTests.ClientResult.cs (6)
116client.Connection.Abort(); 123Assert.Equal($"Connection '{client.Connection.ConnectionId}' disconnected.", ex.Message); 146var resultTask = context.Clients.Client(client.Connection.ConnectionId).InvokeAsync<int>("GetClientResult", 1, cancellationToken: default); 171var connectionId = client.Connection.ConnectionId; 363var connectionId = client.Connection.ConnectionId; 408var connectionId = client.Connection.ConnectionId;
HubConnectionHandlerTests.cs (51)
134var firedOnConnected = (bool)client.Connection.Items[nameof(ErrorInAbortedTokenHub.OnConnectedAsync)]; 135var firedOnDisconnected = (bool)client.Connection.Items[nameof(ErrorInAbortedTokenHub.OnDisconnectedAsync)]; 354await client.Connection.Application.Output.WriteAsync(part1); 358await client.Connection.Application.Output.WriteAsync(part2); 362await client.Connection.Application.Output.WriteAsync(part3); 395await client.Connection.Application.Output.WriteAsync(part1); 399await client.Connection.Application.Output.WriteAsync(part2); 403await client.Connection.Application.Output.WriteAsync(part3); 436await client.Connection.Application.Output.WriteAsync(payload); 491await client.Connection.Application.Output.WriteAsync(payload); 520await client.Connection.Application.Output.WriteAsync(payload.AsMemory(0, payload.Length / 2)); 521await client.Connection.Application.Output.WriteAsync(payload.AsMemory(payload.Length / 2)); 554client.Connection.Application.Output.Write(payload1); 555client.Connection.Application.Output.Write(payload2); 556client.Connection.Application.Output.Write(payload3); 557await client.Connection.Application.Output.FlushAsync(); 605client.Connection.Application.Output.Write(payload1); 606client.Connection.Application.Output.Write(payload2); 607client.Connection.Application.Output.Write(payload3); 608await client.Connection.Application.Output.FlushAsync(); 669await client.Connection.Application.Output.WriteAsync(payload).DefaultTimeout(); 673client.Connection.Application.Output.Complete(); 962client.Connection.Abort(); 1566excludeSecondClientId.Add(secondClient.Connection.ConnectionId); 1568excludeThirdClientId.Add(thirdClient.Connection.ConnectionId); 1611var secondAndThirdClients = new HashSet<string> {secondClient.Connection.ConnectionId, 1612thirdClient.Connection.ConnectionId }; 1757var excludedConnectionIds = new List<string> { firstClient.Connection.ConnectionId }; 1950await firstClient.SendInvocationAsync("ConnectionSendMethod", secondClient.Connection.ConnectionId, "test").DefaultTimeout(); 1983await firstClient.SendInvocationAsync("DelayedSend", secondClient.Connection.ConnectionId, "test").DefaultTimeout(); 2245client.Connection.User.AddIdentity(new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, "name") })); 2284client.Connection.Features.Set<IConnectionLifetimeNotificationFeature>(new TestConnectionLifetimeNotification()); 2290client.Connection.Features.Get<IConnectionLifetimeNotificationFeature>().RequestClose(); 2347client.Connection.User.AddIdentity(new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, "name") })); 2352client.Connection.Features.Set<IHttpContextFeature>(httpConnectionContext); 2623client.Connection.Features.Set<IHttpContextFeature>(feature); 2719client.Connection.Transport.Output.Complete(); 2765client.Connection.Transport.Output.Complete(); 3023var customDuplex = new CustomDuplex(client.Connection.Transport); 3024client.Connection.Transport = customDuplex; 3118client.Connection.Transport.Output.Complete(); 3566await client.Connection.Application.Output.WriteAsync(Encoding.UTF8.GetBytes(new[] { '{' })).DefaultTimeout(); 3569client.Connection.Application.Output.Complete(); 4583var task = (Task<int>)client.Connection.Items[nameof(MethodHub.UploadDoesWorkOnComplete)]; 5093httpContext.Request.QueryString = new QueryString($"?client={client1.Connection.ConnectionId}"); 5098client2.Connection.Features.Set<IHttpContextFeature>(feature); 5205client.Connection.Features.Set<IStatefulReconnectFeature>(new EmptyReconnectFeature()); 5250client.Connection.Features.Set<IStatefulReconnectFeature>(reconnectFeature); 5254UpdateConnectionPair(client.Connection); 5256await reconnectFeature.NotifyOnReconnect(client.Connection.Transport.Output); 5314client.Connection.Features.Set<IStatefulReconnectFeature>(reconnectFeature);
Microsoft.AspNetCore.SignalR.Tests.Utils (13)
TestClient.cs (13)
34public Task Connected => ((TaskCompletionSource)Connection.Items["ConnectedTask"]).Task; 49Connection.Features.Set<ITransferFormatFeature>(this); 50Connection.Features.Set<IConnectionHeartbeatFeature>(this); 59Connection.User = new ClaimsPrincipal(new ClaimsIdentity(claims)); 60Connection.Items["ConnectedTask"] = new TaskCompletionSource(); 75await Connection.Application.Output.WriteAsync(GetHandshakeRequestMessage()); 78var connection = handler.OnConnectedAsync(Connection); 236await Connection.Application.Output.WriteAsync(payload); 248var result = await Connection.Application.Input.ReadAsync(); 265Connection.Application.Input.AdvanceTo(buffer.Start); 277if (!Connection.Application.Input.TryRead(out var result)) 304Connection.Application.Input.AdvanceTo(buffer.Start); 314Connection.Application.Output.Complete();