Use protocol.abstractions primitives instead of socket abstractions (#1429)
This commit is contained in:
parent
2ed78d5762
commit
e3f197cef0
|
|
@ -7,51 +7,52 @@
|
|||
<BuildBundlerMinifierPackageVersion>2.4.337</BuildBundlerMinifierPackageVersion>
|
||||
<GoogleProtobufPackageVersion>3.1.0</GoogleProtobufPackageVersion>
|
||||
<InternalAspNetCoreSdkPackageVersion>2.1.0-preview2-15698</InternalAspNetCoreSdkPackageVersion>
|
||||
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
|
||||
<MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
|
||||
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
|
||||
<MicrosoftAspNetCoreAuthorizationPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthorizationPackageVersion>
|
||||
<MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>
|
||||
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
|
||||
<MicrosoftAspNetCoreCorsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreCorsPackageVersion>
|
||||
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
|
||||
<MicrosoftAspNetCoreDiagnosticsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreDiagnosticsPackageVersion>
|
||||
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
|
||||
<MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHostingPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHttpAbstractionsPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpFeaturesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHttpFeaturesPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHttpPackageVersion>
|
||||
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
|
||||
<MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreMvcPackageVersion>
|
||||
<MicrosoftAspNetCoreRoutingPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreRoutingPackageVersion>
|
||||
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
||||
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.5.0-preview2-30066</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
|
||||
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
||||
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreStaticFilesPackageVersion>
|
||||
<MicrosoftAspNetCoreTestHostPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreTestHostPackageVersion>
|
||||
<MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreTestingPackageVersion>
|
||||
<MicrosoftAspNetCoreWebSocketsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreWebSocketsPackageVersion>
|
||||
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
|
||||
<MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
|
||||
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
|
||||
<MicrosoftAspNetCoreAuthorizationPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthorizationPackageVersion>
|
||||
<MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>
|
||||
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
|
||||
<MicrosoftAspNetCoreCorsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreCorsPackageVersion>
|
||||
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
|
||||
<MicrosoftAspNetCoreDiagnosticsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreDiagnosticsPackageVersion>
|
||||
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
|
||||
<MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHostingPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHttpAbstractionsPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpFeaturesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHttpFeaturesPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHttpPackageVersion>
|
||||
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
|
||||
<MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreMvcPackageVersion>
|
||||
<MicrosoftAspNetCoreProtocolsAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreProtocolsAbstractionsPackageVersion>
|
||||
<MicrosoftAspNetCoreRoutingPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreRoutingPackageVersion>
|
||||
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
||||
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.5.0-preview2-30070</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
|
||||
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
||||
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreStaticFilesPackageVersion>
|
||||
<MicrosoftAspNetCoreTestHostPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreTestHostPackageVersion>
|
||||
<MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreTestingPackageVersion>
|
||||
<MicrosoftAspNetCoreWebSocketsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreWebSocketsPackageVersion>
|
||||
<MicrosoftCSharpPackageVersion>4.5.0-preview2-26130-01</MicrosoftCSharpPackageVersion>
|
||||
<MicrosoftEntityFrameworkCoreDesignPackageVersion>2.1.0-preview2-30066</MicrosoftEntityFrameworkCoreDesignPackageVersion>
|
||||
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>2.1.0-preview2-30066</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
|
||||
<MicrosoftEntityFrameworkCoreToolsPackageVersion>2.1.0-preview2-30066</MicrosoftEntityFrameworkCoreToolsPackageVersion>
|
||||
<MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>
|
||||
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
|
||||
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
|
||||
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
|
||||
<MicrosoftExtensionsConfigurationUserSecretsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsConfigurationUserSecretsPackageVersion>
|
||||
<MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>
|
||||
<MicrosoftExtensionsDependencyInjectionPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsDependencyInjectionPackageVersion>
|
||||
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
|
||||
<MicrosoftExtensionsLoggingConfigurationPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingConfigurationPackageVersion>
|
||||
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingConsolePackageVersion>
|
||||
<MicrosoftExtensionsLoggingDebugPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingDebugPackageVersion>
|
||||
<MicrosoftExtensionsLoggingPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingPackageVersion>
|
||||
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingTestingPackageVersion>
|
||||
<MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>
|
||||
<MicrosoftExtensionsOptionsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsOptionsPackageVersion>
|
||||
<MicrosoftExtensionsSecurityHelperSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsSecurityHelperSourcesPackageVersion>
|
||||
<MicrosoftExtensionsValueStopwatchSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsValueStopwatchSourcesPackageVersion>
|
||||
<MicrosoftEntityFrameworkCoreDesignPackageVersion>2.1.0-preview2-30070</MicrosoftEntityFrameworkCoreDesignPackageVersion>
|
||||
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>2.1.0-preview2-30070</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
|
||||
<MicrosoftEntityFrameworkCoreToolsPackageVersion>2.1.0-preview2-30070</MicrosoftEntityFrameworkCoreToolsPackageVersion>
|
||||
<MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>
|
||||
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
|
||||
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
|
||||
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
|
||||
<MicrosoftExtensionsConfigurationUserSecretsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsConfigurationUserSecretsPackageVersion>
|
||||
<MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>
|
||||
<MicrosoftExtensionsDependencyInjectionPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsDependencyInjectionPackageVersion>
|
||||
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
|
||||
<MicrosoftExtensionsLoggingConfigurationPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingConfigurationPackageVersion>
|
||||
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingConsolePackageVersion>
|
||||
<MicrosoftExtensionsLoggingDebugPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingDebugPackageVersion>
|
||||
<MicrosoftExtensionsLoggingPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingPackageVersion>
|
||||
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingTestingPackageVersion>
|
||||
<MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>
|
||||
<MicrosoftExtensionsOptionsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsOptionsPackageVersion>
|
||||
<MicrosoftExtensionsSecurityHelperSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsSecurityHelperSourcesPackageVersion>
|
||||
<MicrosoftExtensionsValueStopwatchSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsValueStopwatchSourcesPackageVersion>
|
||||
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
|
||||
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26130-04</MicrosoftNETCoreApp21PackageVersion>
|
||||
<MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion>
|
||||
|
|
@ -70,7 +71,7 @@
|
|||
<SystemThreadingChannelsPackageVersion>4.5.0-preview2-26130-01</SystemThreadingChannelsPackageVersion>
|
||||
<SystemThreadingTasksExtensionsPackageVersion>4.5.0-preview2-26130-01</SystemThreadingTasksExtensionsPackageVersion>
|
||||
<XunitPackageVersion>2.3.1</XunitPackageVersion>
|
||||
<XunitRunnerVisualStudioPackageVersion>2.3.1</XunitRunnerVisualStudioPackageVersion>
|
||||
<XunitRunnerVisualStudioPackageVersion>2.4.0-beta.1.build3945</XunitRunnerVisualStudioPackageVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
|
||||
</Project>
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System.IO.Pipelines;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Sockets;
|
||||
|
||||
namespace FunctionalTests
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.IO.Pipelines;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Sockets;
|
||||
using Microsoft.AspNetCore.Sockets.Features;
|
||||
|
||||
|
|
@ -23,9 +24,9 @@ namespace SocialWeather
|
|||
|
||||
public void OnConnectedAsync(ConnectionContext connection)
|
||||
{
|
||||
connection.Metadata["groups"] = new HashSet<string>();
|
||||
connection.Features.Get<IConnectionMetadataFeature>().Metadata["groups"] = new HashSet<string>();
|
||||
var format = connection.GetHttpContext().Request.Query["formatType"].ToString();
|
||||
connection.Metadata["format"] = format;
|
||||
connection.Features.Get<IConnectionMetadataFeature>().Metadata["format"] = format;
|
||||
if (string.Equals(format, "protobuf", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var transferModeFeature = connection.Features.Get<ITransferModeFeature>();
|
||||
|
|
@ -47,7 +48,7 @@ namespace SocialWeather
|
|||
foreach (var connection in _connectionList)
|
||||
{
|
||||
var context = connection.GetHttpContext();
|
||||
var formatter = _formatterResolver.GetFormatter<T>((string)connection.Metadata["format"]);
|
||||
var formatter = _formatterResolver.GetFormatter<T>((string)connection.Features.Get<IConnectionMetadataFeature>().Metadata["format"]);
|
||||
var ms = new MemoryStream();
|
||||
await formatter.WriteAsync(data, ms);
|
||||
|
||||
|
|
@ -72,7 +73,7 @@ namespace SocialWeather
|
|||
|
||||
public void AddGroupAsync(ConnectionContext connection, string groupName)
|
||||
{
|
||||
var groups = (HashSet<string>)connection.Metadata["groups"];
|
||||
var groups = (HashSet<string>)connection.Features.Get<IConnectionMetadataFeature>().Metadata["groups"];
|
||||
lock (groups)
|
||||
{
|
||||
groups.Add(groupName);
|
||||
|
|
@ -81,7 +82,7 @@ namespace SocialWeather
|
|||
|
||||
public void RemoveGroupAsync(ConnectionContext connection, string groupName)
|
||||
{
|
||||
var groups = (HashSet<string>)connection.Metadata["groups"];
|
||||
var groups = (HashSet<string>)connection.Features.Get<IConnectionMetadataFeature>().Metadata["groups"];
|
||||
if (groups != null)
|
||||
{
|
||||
lock (groups)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Sockets;
|
||||
using Microsoft.AspNetCore.Sockets.Features;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace SocialWeather
|
||||
|
|
@ -32,7 +34,7 @@ namespace SocialWeather
|
|||
public async Task ProcessRequests(ConnectionContext connection)
|
||||
{
|
||||
var formatter = _formatterResolver.GetFormatter<WeatherReport>(
|
||||
(string)connection.Metadata["format"]);
|
||||
(string)connection.Features.Get<IConnectionMetadataFeature>().Metadata["format"]);
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ using System.Collections.Generic;
|
|||
using System.IO.Pipelines;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Sockets;
|
||||
using Microsoft.AspNetCore.Sockets.Features;
|
||||
|
||||
namespace SocketsSample.EndPoints
|
||||
{
|
||||
|
|
@ -17,7 +19,7 @@ namespace SocketsSample.EndPoints
|
|||
{
|
||||
Connections.Add(connection);
|
||||
|
||||
await Broadcast($"{connection.ConnectionId} connected ({connection.Metadata[ConnectionMetadataNames.Transport]})");
|
||||
await Broadcast($"{connection.ConnectionId} connected ({connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport]})");
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -50,7 +52,7 @@ namespace SocketsSample.EndPoints
|
|||
{
|
||||
Connections.Remove(connection);
|
||||
|
||||
await Broadcast($"{connection.ConnectionId} disconnected ({connection.Metadata[ConnectionMetadataNames.Transport]})");
|
||||
await Broadcast($"{connection.ConnectionId} disconnected ({connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport]})");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@
|
|||
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SocketsSample.Hubs;
|
||||
|
||||
namespace SocketsSample
|
||||
{
|
||||
|
|
@ -23,7 +25,18 @@ namespace SocketsSample
|
|||
{
|
||||
factory.AddConsole();
|
||||
})
|
||||
.UseKestrel()
|
||||
.UseKestrel(options =>
|
||||
{
|
||||
// Default port
|
||||
options.ListenLocalhost(5000);
|
||||
|
||||
// Hub bound to TCP end point
|
||||
options.ListenLocalhost(9001, builder =>
|
||||
{
|
||||
// Run the hub on this port (this won't work properly until streaming parsing is implemented)
|
||||
builder.UseHub<Chat>();
|
||||
});
|
||||
})
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.UseStartup<Startup>()
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using System.Threading;
|
|||
using System.Threading.Channels;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.SignalR.Core;
|
||||
using Microsoft.AspNetCore.SignalR.Internal;
|
||||
using Microsoft.AspNetCore.SignalR.Internal.Encoders;
|
||||
|
|
@ -64,7 +65,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
|
||||
public virtual IFeatureCollection Features => _connectionContext.Features;
|
||||
|
||||
public virtual IDictionary<object, object> Metadata => _connectionContext.Metadata;
|
||||
public virtual IDictionary<object, object> Metadata => Features.Get<IConnectionMetadataFeature>().Metadata;
|
||||
|
||||
public virtual PipeReader Input => _connectionContext.Transport.Input;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ using System.Threading;
|
|||
using System.Threading.Channels;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.SignalR.Core;
|
||||
using Microsoft.AspNetCore.SignalR.Internal;
|
||||
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
|
||||
using Microsoft.AspNetCore.Sockets;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Internal;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// 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 Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Sockets;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
|
|
@ -8,7 +9,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
{
|
||||
public static class SignalRSocketBuilderExtensions
|
||||
{
|
||||
public static ISocketBuilder UseHub<THub>(this ISocketBuilder socketBuilder) where THub : Hub
|
||||
public static IConnectionBuilder UseHub<THub>(this IConnectionBuilder socketBuilder) where THub : Hub
|
||||
{
|
||||
var endpoint = socketBuilder.ApplicationServices.GetRequiredService<HubEndPoint<THub>>();
|
||||
return socketBuilder.Run(connection => endpoint.OnConnectedAsync(connection));
|
||||
|
|
|
|||
|
|
@ -6,29 +6,30 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
|
||||
namespace Microsoft.AspNetCore.Sockets
|
||||
{
|
||||
public class SocketBuilder : ISocketBuilder
|
||||
public class ConnectionBuilder : IConnectionBuilder
|
||||
{
|
||||
private readonly IList<Func<SocketDelegate, SocketDelegate>> _components = new List<Func<SocketDelegate, SocketDelegate>>();
|
||||
private readonly IList<Func<ConnectionDelegate, ConnectionDelegate>> _components = new List<Func<ConnectionDelegate, ConnectionDelegate>>();
|
||||
|
||||
public IServiceProvider ApplicationServices { get; }
|
||||
|
||||
public SocketBuilder(IServiceProvider applicationServices)
|
||||
public ConnectionBuilder(IServiceProvider applicationServices)
|
||||
{
|
||||
ApplicationServices = applicationServices;
|
||||
}
|
||||
|
||||
public ISocketBuilder Use(Func<SocketDelegate, SocketDelegate> middleware)
|
||||
public IConnectionBuilder Use(Func<ConnectionDelegate, ConnectionDelegate> middleware)
|
||||
{
|
||||
_components.Add(middleware);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SocketDelegate Build()
|
||||
public ConnectionDelegate Build()
|
||||
{
|
||||
SocketDelegate app = features =>
|
||||
ConnectionDelegate app = features =>
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
// 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;
|
||||
using System.IO.Pipelines;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
|
||||
namespace Microsoft.AspNetCore.Sockets
|
||||
{
|
||||
public abstract class ConnectionContext
|
||||
{
|
||||
public abstract string ConnectionId { get; set; }
|
||||
|
||||
public abstract IFeatureCollection Features { get; }
|
||||
|
||||
public abstract IDictionary<object, object> Metadata { get; set; }
|
||||
|
||||
public abstract IDuplexPipe Transport { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
// 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.Text;
|
||||
|
||||
namespace Microsoft.AspNetCore.Sockets
|
||||
{
|
||||
public interface ISocketBuilder
|
||||
{
|
||||
IServiceProvider ApplicationServices { get; }
|
||||
|
||||
ISocketBuilder Use(Func<SocketDelegate, SocketDelegate> middleware);
|
||||
|
||||
SocketDelegate Build();
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="$(MicrosoftAspNetCoreHttpFeaturesPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Protocols.Abstractions" Version="$(MicrosoftAspNetCoreProtocolsAbstractionsPackageVersion)" />
|
||||
<PackageReference Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" />
|
||||
<PackageReference Include="System.IO.Pipelines" Version="$(SystemIOPipelinesPackageVersion)" />
|
||||
<PackageReference Include="System.Memory" Version="$(SystemMemoryPackageVersion)" />
|
||||
|
|
|
|||
|
|
@ -3,12 +3,13 @@
|
|||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
|
||||
namespace Microsoft.AspNetCore.Sockets
|
||||
{
|
||||
public static class SocketBuilderExtensions
|
||||
{
|
||||
public static ISocketBuilder Use(this ISocketBuilder socketBuilder, Func<ConnectionContext, Func<Task>, Task> middleware)
|
||||
public static IConnectionBuilder Use(this IConnectionBuilder socketBuilder, Func<ConnectionContext, Func<Task>, Task> middleware)
|
||||
{
|
||||
return socketBuilder.Use(next =>
|
||||
{
|
||||
|
|
@ -20,7 +21,7 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
});
|
||||
}
|
||||
|
||||
public static ISocketBuilder Run(this ISocketBuilder socketBuilder, Func<ConnectionContext, Task> middleware)
|
||||
public static IConnectionBuilder Run(this IConnectionBuilder socketBuilder, Func<ConnectionContext, Task> middleware)
|
||||
{
|
||||
return socketBuilder.Use(next =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
// 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.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Sockets
|
||||
{
|
||||
public delegate Task SocketDelegate(ConnectionContext connection);
|
||||
}
|
||||
|
|
@ -1,10 +1,8 @@
|
|||
// 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.Text;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Sockets.Http.Features;
|
||||
|
||||
namespace Microsoft.AspNetCore.Sockets
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Sockets.Features;
|
||||
using Microsoft.AspNetCore.Sockets.Internal;
|
||||
using Microsoft.AspNetCore.Sockets.Internal.Transports;
|
||||
|
|
@ -32,7 +33,7 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
_logger = _loggerFactory.CreateLogger<HttpConnectionDispatcher>();
|
||||
}
|
||||
|
||||
public async Task ExecuteAsync(HttpContext context, HttpSocketOptions options, SocketDelegate socketDelegate)
|
||||
public async Task ExecuteAsync(HttpContext context, HttpSocketOptions options, ConnectionDelegate ConnectionDelegate)
|
||||
{
|
||||
// Create the log scope and attempt to pass the Connection ID to it so as many logs as possible contain
|
||||
// the Connection ID metadata. If this is the negotiate request then the Connection ID for the scope will
|
||||
|
|
@ -53,7 +54,7 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
else if (HttpMethods.IsGet(context.Request.Method))
|
||||
{
|
||||
// GET /{path}
|
||||
await ExecuteEndpointAsync(context, socketDelegate, options, logScope);
|
||||
await ExecuteEndpointAsync(context, ConnectionDelegate, options, logScope);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -87,7 +88,7 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
}
|
||||
}
|
||||
|
||||
private async Task ExecuteEndpointAsync(HttpContext context, SocketDelegate socketDelegate, HttpSocketOptions options, ConnectionLogScope logScope)
|
||||
private async Task ExecuteEndpointAsync(HttpContext context, ConnectionDelegate ConnectionDelegate, HttpSocketOptions options, ConnectionLogScope logScope)
|
||||
{
|
||||
var supportedTransports = options.Transports;
|
||||
|
||||
|
|
@ -119,7 +120,7 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
// We only need to provide the Input channel since writing to the application is handled through /send.
|
||||
var sse = new ServerSentEventsTransport(connection.Application.Input, connection.ConnectionId, _loggerFactory);
|
||||
|
||||
await DoPersistentConnection(socketDelegate, sse, context, connection);
|
||||
await DoPersistentConnection(ConnectionDelegate, sse, context, connection);
|
||||
}
|
||||
else if (context.WebSockets.IsWebSocketRequest)
|
||||
{
|
||||
|
|
@ -141,7 +142,7 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
|
||||
var ws = new WebSocketsTransport(options.WebSockets, connection.Application, connection, _loggerFactory);
|
||||
|
||||
await DoPersistentConnection(socketDelegate, ws, context, connection);
|
||||
await DoPersistentConnection(ConnectionDelegate, ws, context, connection);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -202,7 +203,7 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
|
||||
connection.Metadata[ConnectionMetadataNames.Transport] = TransportType.LongPolling;
|
||||
|
||||
connection.ApplicationTask = ExecuteApplication(socketDelegate, connection);
|
||||
connection.ApplicationTask = ExecuteApplication(ConnectionDelegate, connection);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -291,7 +292,7 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
}
|
||||
}
|
||||
|
||||
private async Task DoPersistentConnection(SocketDelegate socketDelegate,
|
||||
private async Task DoPersistentConnection(ConnectionDelegate ConnectionDelegate,
|
||||
IHttpTransport transport,
|
||||
HttpContext context,
|
||||
DefaultConnectionContext connection)
|
||||
|
|
@ -323,7 +324,7 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
connection.Status = DefaultConnectionContext.ConnectionStatus.Active;
|
||||
|
||||
// Call into the end point passing the connection
|
||||
connection.ApplicationTask = ExecuteApplication(socketDelegate, connection);
|
||||
connection.ApplicationTask = ExecuteApplication(ConnectionDelegate, connection);
|
||||
|
||||
// Start the transport
|
||||
connection.TransportTask = transport.ProcessRequestAsync(context, context.RequestAborted);
|
||||
|
|
@ -339,12 +340,12 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
await _manager.DisposeAndRemoveAsync(connection);
|
||||
}
|
||||
|
||||
private async Task ExecuteApplication(SocketDelegate socketDelegate, ConnectionContext connection)
|
||||
private async Task ExecuteApplication(ConnectionDelegate ConnectionDelegate, ConnectionContext connection)
|
||||
{
|
||||
// Verify some initialization invariants
|
||||
// We want to be positive that the IConnectionInherentKeepAliveFeature is initialized before invoking the application, if the long polling transport is in use.
|
||||
Debug.Assert(connection.Metadata[ConnectionMetadataNames.Transport] != null, "Transport has not been initialized yet");
|
||||
Debug.Assert((TransportType?)connection.Metadata[ConnectionMetadataNames.Transport] != TransportType.LongPolling ||
|
||||
Debug.Assert(connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport] != null, "Transport has not been initialized yet");
|
||||
Debug.Assert((TransportType?)connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport] != TransportType.LongPolling ||
|
||||
connection.Features.Get<IConnectionInherentKeepAliveFeature>() != null, "Long-polling transport is in use but IConnectionInherentKeepAliveFeature as not configured");
|
||||
|
||||
// Jump onto the thread pool thread so blocking user code doesn't block the setup of the
|
||||
|
|
@ -352,7 +353,7 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
await AwaitableThreadPool.Yield();
|
||||
|
||||
// Running this in an async method turns sync exceptions into async ones
|
||||
await socketDelegate(connection);
|
||||
await ConnectionDelegate(connection);
|
||||
}
|
||||
|
||||
private Task ProcessNegotiate(HttpContext context, HttpSocketOptions options, ConnectionLogScope logScope)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Reflection;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
|
||||
namespace Microsoft.AspNetCore.Sockets
|
||||
|
|
@ -20,15 +21,15 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
_dispatcher = dispatcher;
|
||||
}
|
||||
|
||||
public void MapSocket(string path, Action<ISocketBuilder> socketConfig) =>
|
||||
public void MapSocket(string path, Action<IConnectionBuilder> socketConfig) =>
|
||||
MapSocket(new PathString(path), new HttpSocketOptions(), socketConfig);
|
||||
|
||||
public void MapSocket(PathString path, Action<ISocketBuilder> socketConfig) =>
|
||||
public void MapSocket(PathString path, Action<IConnectionBuilder> socketConfig) =>
|
||||
MapSocket(path, new HttpSocketOptions(), socketConfig);
|
||||
|
||||
public void MapSocket(PathString path, HttpSocketOptions options, Action<ISocketBuilder> socketConfig)
|
||||
public void MapSocket(PathString path, HttpSocketOptions options, Action<IConnectionBuilder> socketConfig)
|
||||
{
|
||||
var socketBuilder = new SocketBuilder(_routes.ServiceProvider);
|
||||
var socketBuilder = new ConnectionBuilder(_routes.ServiceProvider);
|
||||
socketConfig(socketBuilder);
|
||||
var socket = socketBuilder.Build();
|
||||
_routes.MapRoute(path, c => _dispatcher.ExecuteAsync(c, options, socket));
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
|
||||
namespace Microsoft.AspNetCore.Sockets
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Pipelines;
|
||||
using System.Security.Claims;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Sockets.Features;
|
||||
using Microsoft.Extensions.Internal;
|
||||
|
||||
|
|
@ -63,7 +65,7 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
|
||||
public ClaimsPrincipal User { get; set; }
|
||||
|
||||
public override IDictionary<object, object> Metadata { get; set; } = new ConnectionMetadata();
|
||||
public IDictionary<object, object> Metadata { get; set; } = new ConnectionMetadata();
|
||||
|
||||
public IDuplexPipe Application { get; }
|
||||
|
||||
|
|
@ -73,6 +75,8 @@ namespace Microsoft.AspNetCore.Sockets
|
|||
|
||||
public TransferMode TransferMode { get; set; }
|
||||
|
||||
public override MemoryPool MemoryPool { get; }
|
||||
|
||||
public void OnHeartbeat(Action<object> action, object state)
|
||||
{
|
||||
lock (_heartbeatHandlers)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
|
||||
namespace Microsoft.AspNetCore.Sockets
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
// 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 Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Microsoft.AspNetCore.Sockets
|
||||
{
|
||||
public static class SocketBuilderExtensions
|
||||
{
|
||||
public static ISocketBuilder UseEndPoint<TEndPoint>(this ISocketBuilder socketBuilder) where TEndPoint : EndPoint
|
||||
public static IConnectionBuilder UseEndPoint<TEndPoint>(this IConnectionBuilder socketBuilder) where TEndPoint : EndPoint
|
||||
{
|
||||
var endpoint = socketBuilder.ApplicationServices.GetRequiredService<TEndPoint>();
|
||||
// This is a terminal middleware, so there's no need to use the 'next' parameter
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System.IO.Pipelines;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Sockets;
|
||||
|
||||
namespace Microsoft.AspNetCore.SignalR.Tests
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.SignalR.Internal;
|
||||
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
|
||||
using Microsoft.AspNetCore.Sockets;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Authorization;
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.Http.Internal;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Sockets.Features;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -116,7 +117,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
context.Request.Query = qs;
|
||||
SetTransport(context, transportType);
|
||||
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
|
||||
|
|
@ -151,7 +152,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
var qs = new QueryCollection(values);
|
||||
context.Request.Query = qs;
|
||||
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
|
||||
|
|
@ -188,7 +189,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
var qs = new QueryCollection(values);
|
||||
context.Request.Query = qs;
|
||||
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
|
||||
|
|
@ -233,7 +234,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
var qs = new QueryCollection(values);
|
||||
context.Request.Query = qs;
|
||||
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
|
||||
|
|
@ -268,7 +269,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
SetTransport(context, transportType);
|
||||
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
|
||||
|
|
@ -297,7 +298,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
context.Request.Path = "/foo";
|
||||
context.Request.Method = "POST";
|
||||
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
|
||||
|
|
@ -370,7 +371,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<ImmediatelyCompleteEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
|
||||
var app = builder.Build();
|
||||
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
|
||||
|
|
@ -396,7 +397,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<SynchronusExceptionEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<SynchronusExceptionEndPoint>();
|
||||
var app = builder.Build();
|
||||
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
|
||||
|
|
@ -422,7 +423,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<ImmediatelyCompleteEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
|
||||
var app = builder.Build();
|
||||
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
|
||||
|
|
@ -448,7 +449,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<TestEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -474,7 +475,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<ImmediatelyCompleteEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -506,7 +507,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<TestEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -545,7 +546,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<TestEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -583,7 +584,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<TestEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -608,7 +609,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<TestEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -643,7 +644,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<BlockingEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<BlockingEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -676,7 +677,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<BlockingEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<BlockingEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -707,7 +708,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<TestEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -751,7 +752,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<ImmediatelyCompleteEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
|
||||
var app = builder.Build();
|
||||
|
||||
|
|
@ -795,7 +796,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
var qs = new QueryCollection(values);
|
||||
context.Request.Query = qs;
|
||||
|
||||
var builder = new SocketBuilder(sp);
|
||||
var builder = new ConnectionBuilder(sp);
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -840,7 +841,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
var qs = new QueryCollection(values);
|
||||
context.Request.Query = qs;
|
||||
|
||||
var builder = new SocketBuilder(sp);
|
||||
var builder = new ConnectionBuilder(sp);
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -892,7 +893,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
context.Request.Query = qs;
|
||||
context.Response.Body = new MemoryStream();
|
||||
|
||||
var builder = new SocketBuilder(sp);
|
||||
var builder = new ConnectionBuilder(sp);
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -952,7 +953,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
context.Request.Query = qs;
|
||||
context.Response.Body = new MemoryStream();
|
||||
|
||||
var builder = new SocketBuilder(sp);
|
||||
var builder = new ConnectionBuilder(sp);
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -1030,7 +1031,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
context.Request.Query = qs;
|
||||
context.Response.Body = new MemoryStream();
|
||||
|
||||
var builder = new SocketBuilder(sp);
|
||||
var builder = new ConnectionBuilder(sp);
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -1086,7 +1087,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
context.Request.Query = qs;
|
||||
context.Response.Body = new MemoryStream();
|
||||
|
||||
var builder = new SocketBuilder(sp);
|
||||
var builder = new ConnectionBuilder(sp);
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -1116,7 +1117,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
|
||||
var services = new ServiceCollection();
|
||||
services.AddEndPoint<TestEndPoint>();
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<TestEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
@ -1196,7 +1197,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
var qs = new QueryCollection(values);
|
||||
context.Request.Query = qs;
|
||||
|
||||
var builder = new SocketBuilder(services.BuildServiceProvider());
|
||||
var builder = new ConnectionBuilder(services.BuildServiceProvider());
|
||||
builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
|
||||
var app = builder.Build();
|
||||
var options = new HttpSocketOptions();
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Authorization;
|
|||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using Microsoft.AspNetCore.Protocols;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
|
|||
Loading…
Reference in New Issue