diff --git a/benchmarks/Microsoft.AspNetCore.SignalR.Microbenchmarks/DefaultHubDispatcherBenchmark.cs b/benchmarks/Microsoft.AspNetCore.SignalR.Microbenchmarks/DefaultHubDispatcherBenchmark.cs
index d21bb61c40..7128043e4e 100644
--- a/benchmarks/Microsoft.AspNetCore.SignalR.Microbenchmarks/DefaultHubDispatcherBenchmark.cs
+++ b/benchmarks/Microsoft.AspNetCore.SignalR.Microbenchmarks/DefaultHubDispatcherBenchmark.cs
@@ -9,7 +9,7 @@ using System.Reactive.Linq;
using System.Threading.Channels;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
using Microsoft.AspNetCore.Sockets;
diff --git a/build/dependencies.props b/build/dependencies.props
index 7590b78207..4308906952 100644
--- a/build/dependencies.props
+++ b/build/dependencies.props
@@ -22,11 +22,11 @@
2.1.0-preview2-30355
2.1.0-preview2-30355
2.1.0-preview2-30355
- 2.1.0-preview2-30355
+ 2.1.0-a-preview2-bedrock-renames-17598
2.1.0-preview2-30355
2.1.0-preview2-30355
0.5.0-preview2-30355
- 2.1.0-preview2-30355
+ 2.1.0-a-preview2-bedrock-renames-17598
2.1.0-preview2-30355
2.1.0-preview2-30355
2.1.0-preview2-30355
diff --git a/clients/ts/FunctionalTests/EchoEndPoint.cs b/clients/ts/FunctionalTests/EchoConnectionHandler.cs
similarity index 90%
rename from clients/ts/FunctionalTests/EchoEndPoint.cs
rename to clients/ts/FunctionalTests/EchoConnectionHandler.cs
index ed08754845..1dcf340e04 100644
--- a/clients/ts/FunctionalTests/EchoEndPoint.cs
+++ b/clients/ts/FunctionalTests/EchoConnectionHandler.cs
@@ -3,13 +3,13 @@
using System.Buffers;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
-using Microsoft.AspNetCore.Protocols.Features;
+using Microsoft.AspNetCore.Connections;
+using Microsoft.AspNetCore.Connections.Features;
using Microsoft.AspNetCore.Sockets;
namespace FunctionalTests
{
- public class EchoEndPoint : EndPoint
+ public class EchoConnectionHandler : ConnectionHandler
{
public async override Task OnConnectedAsync(ConnectionContext connection)
{
diff --git a/clients/ts/FunctionalTests/Startup.cs b/clients/ts/FunctionalTests/Startup.cs
index a5b77ef60d..6c65dc518e 100644
--- a/clients/ts/FunctionalTests/Startup.cs
+++ b/clients/ts/FunctionalTests/Startup.cs
@@ -23,7 +23,7 @@ namespace FunctionalTests
public void ConfigureServices(IServiceCollection services)
{
- services.AddSockets();
+ services.AddConnections();
services.AddSignalR()
.AddJsonProtocol(options =>
{
@@ -70,7 +70,6 @@ namespace FunctionalTests
}
};
});
- services.AddSingleton();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
@@ -81,9 +80,9 @@ namespace FunctionalTests
}
app.UseFileServer();
- app.UseSockets(routes =>
+ app.UseConnections(routes =>
{
- routes.MapEndPoint("/echo");
+ routes.MapConnectionHandler("/echo");
});
app.UseSignalR(routes =>
diff --git a/samples/ClientSample/RawSample.cs b/samples/ClientSample/RawSample.cs
index c4d8f614fb..5ac8c1a6cb 100644
--- a/samples/ClientSample/RawSample.cs
+++ b/samples/ClientSample/RawSample.cs
@@ -8,7 +8,7 @@ using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Client;
using Microsoft.Extensions.CommandLineUtils;
diff --git a/samples/SocialWeather/ConnectionList.cs b/samples/SocialWeather/ConnectionList.cs
index 870c1fb44e..7806439a33 100644
--- a/samples/SocialWeather/ConnectionList.cs
+++ b/samples/SocialWeather/ConnectionList.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
namespace Microsoft.AspNetCore.Sockets
{
diff --git a/samples/SocialWeather/PersistentConnectionLifeTimeManager.cs b/samples/SocialWeather/PersistentConnectionLifeTimeManager.cs
index 00d625ff5c..c95e16a738 100644
--- a/samples/SocialWeather/PersistentConnectionLifeTimeManager.cs
+++ b/samples/SocialWeather/PersistentConnectionLifeTimeManager.cs
@@ -5,8 +5,8 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
-using Microsoft.AspNetCore.Protocols.Features;
+using Microsoft.AspNetCore.Connections;
+using Microsoft.AspNetCore.Connections.Features;
using Microsoft.AspNetCore.Sockets;
namespace SocialWeather
diff --git a/samples/SocialWeather/SocialWeatherEndPoint.cs b/samples/SocialWeather/SocialWeatherConnectionHandler.cs
similarity index 85%
rename from samples/SocialWeather/SocialWeatherEndPoint.cs
rename to samples/SocialWeather/SocialWeatherConnectionHandler.cs
index f6f5c58b6c..42bf01052e 100644
--- a/samples/SocialWeather/SocialWeatherEndPoint.cs
+++ b/samples/SocialWeather/SocialWeatherConnectionHandler.cs
@@ -4,21 +4,21 @@
using System.Buffers;
using System.IO;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
-using Microsoft.AspNetCore.Protocols.Features;
+using Microsoft.AspNetCore.Connections;
+using Microsoft.AspNetCore.Connections.Features;
using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.Logging;
namespace SocialWeather
{
- public class SocialWeatherEndPoint : EndPoint
+ public class SocialWeatherConnectionHandler : ConnectionHandler
{
private readonly PersistentConnectionLifeTimeManager _lifetimeManager;
private readonly FormatterResolver _formatterResolver;
- private readonly ILogger _logger;
+ private readonly ILogger _logger;
- public SocialWeatherEndPoint(PersistentConnectionLifeTimeManager lifetimeManager,
- FormatterResolver formatterResolver, ILogger logger)
+ public SocialWeatherConnectionHandler(PersistentConnectionLifeTimeManager lifetimeManager,
+ FormatterResolver formatterResolver, ILogger logger)
{
_lifetimeManager = lifetimeManager;
_formatterResolver = formatterResolver;
diff --git a/samples/SocialWeather/Startup.cs b/samples/SocialWeather/Startup.cs
index 2501f09f01..b7721e3a2a 100644
--- a/samples/SocialWeather/Startup.cs
+++ b/samples/SocialWeather/Startup.cs
@@ -15,9 +15,7 @@ namespace SocialWeather
{
public void ConfigureServices(IServiceCollection services)
{
- services.AddRouting();
- services.AddSockets();
- services.AddSingleton();
+ services.AddConnections();
services.AddTransient();
services.AddSingleton(typeof(JsonStreamFormatter<>), typeof(JsonStreamFormatter<>));
services.AddSingleton();
@@ -32,7 +30,7 @@ namespace SocialWeather
app.UseDeveloperExceptionPage();
}
- app.UseSockets(o => { o.MapEndPoint("/weather"); });
+ app.UseConnections(o => o.MapConnectionHandler("/weather"));
app.UseFileServer();
var formatterResolver = app.ApplicationServices.GetRequiredService();
diff --git a/samples/SocketsSample/EndPoints/MessagesEndPoint.cs b/samples/SocketsSample/ConnectionHandlers/MessagesConnectionHandler.cs
similarity index 92%
rename from samples/SocketsSample/EndPoints/MessagesEndPoint.cs
rename to samples/SocketsSample/ConnectionHandlers/MessagesConnectionHandler.cs
index 038e8873fa..9a7b711116 100644
--- a/samples/SocketsSample/EndPoints/MessagesEndPoint.cs
+++ b/samples/SocketsSample/ConnectionHandlers/MessagesConnectionHandler.cs
@@ -5,13 +5,13 @@ using System.Buffers;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
-using Microsoft.AspNetCore.Protocols.Features;
+using Microsoft.AspNetCore.Connections;
+using Microsoft.AspNetCore.Connections.Features;
using Microsoft.AspNetCore.Sockets;
-namespace SocketsSample.EndPoints
+namespace SocketsSample.ConnectionHandlers
{
- public class MessagesEndPoint : EndPoint
+ public class MessagesConnectionHandler : ConnectionHandler
{
private ConnectionList Connections { get; } = new ConnectionList();
diff --git a/samples/SocketsSample/ConnectionList.cs b/samples/SocketsSample/ConnectionList.cs
index 870c1fb44e..7806439a33 100644
--- a/samples/SocketsSample/ConnectionList.cs
+++ b/samples/SocketsSample/ConnectionList.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
namespace Microsoft.AspNetCore.Sockets
{
diff --git a/samples/SocketsSample/Startup.cs b/samples/SocketsSample/Startup.cs
index 5573bacb79..91e7023939 100644
--- a/samples/SocketsSample/Startup.cs
+++ b/samples/SocketsSample/Startup.cs
@@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.DependencyInjection;
using MsgPack.Serialization;
-using SocketsSample.EndPoints;
+using SocketsSample.ConnectionHandlers;
using SocketsSample.Hubs;
using StackExchange.Redis;
@@ -19,7 +19,7 @@ namespace SocketsSample
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
- services.AddSockets();
+ services.AddConnections();
services.AddSignalR(options =>
{
@@ -42,8 +42,6 @@ namespace SocketsSample
.AllowCredentials();
});
});
-
- services.AddSingleton();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -66,9 +64,9 @@ namespace SocketsSample
routes.MapHub("/hubT");
});
- app.UseSockets(routes =>
+ app.UseConnections(routes =>
{
- routes.MapEndPoint("/chat");
+ routes.MapConnectionHandler("/chat");
});
}
}
diff --git a/src/Microsoft.AspNetCore.SignalR.Client.Core/HubConnection.cs b/src/Microsoft.AspNetCore.SignalR.Client.Core/HubConnection.cs
index a5e9e90560..af3d8e2e05 100644
--- a/src/Microsoft.AspNetCore.SignalR.Client.Core/HubConnection.cs
+++ b/src/Microsoft.AspNetCore.SignalR.Client.Core/HubConnection.cs
@@ -8,7 +8,7 @@ using System.IO;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols.Features;
+using Microsoft.AspNetCore.Connections.Features;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
diff --git a/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/IHubProtocol.cs b/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/IHubProtocol.cs
index ab5f071eb5..7430391c7e 100644
--- a/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/IHubProtocol.cs
+++ b/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/IHubProtocol.cs
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
{
diff --git a/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/JsonHubProtocol.cs b/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/JsonHubProtocol.cs
index c7522bf2fc..df6a664f2f 100644
--- a/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/JsonHubProtocol.cs
+++ b/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/JsonHubProtocol.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.Runtime.ExceptionServices;
using System.Text;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
diff --git a/src/Microsoft.AspNetCore.SignalR.Core/HubConnectionContext.cs b/src/Microsoft.AspNetCore.SignalR.Core/HubConnectionContext.cs
index 754bcfb4aa..70a4ce9037 100644
--- a/src/Microsoft.AspNetCore.SignalR.Core/HubConnectionContext.cs
+++ b/src/Microsoft.AspNetCore.SignalR.Core/HubConnectionContext.cs
@@ -14,8 +14,8 @@ using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
-using Microsoft.AspNetCore.Protocols;
-using Microsoft.AspNetCore.Protocols.Features;
+using Microsoft.AspNetCore.Connections;
+using Microsoft.AspNetCore.Connections.Features;
using Microsoft.AspNetCore.SignalR.Core;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
@@ -313,7 +313,7 @@ namespace Microsoft.AspNetCore.SignalR
Abort();
}
- // Used by the HubEndPoint only
+ // Used by the HubConnectionHandler only
internal Task AbortAsync()
{
Abort();
diff --git a/src/Microsoft.AspNetCore.SignalR.Core/HubEndPoint.cs b/src/Microsoft.AspNetCore.SignalR.Core/HubConnectionHandler.cs
similarity index 92%
rename from src/Microsoft.AspNetCore.SignalR.Core/HubEndPoint.cs
rename to src/Microsoft.AspNetCore.SignalR.Core/HubConnectionHandler.cs
index 2ff9c0de1b..d54eeac045 100644
--- a/src/Microsoft.AspNetCore.SignalR.Core/HubEndPoint.cs
+++ b/src/Microsoft.AspNetCore.SignalR.Core/HubConnectionHandler.cs
@@ -5,7 +5,7 @@ using System;
using System.Buffers;
using System.Collections.Generic;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Core;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
@@ -15,31 +15,31 @@ using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.SignalR
{
- public class HubEndPoint : EndPoint where THub : Hub
+ public class HubConnectionHandler : ConnectionHandler where THub : Hub
{
private readonly HubLifetimeManager _lifetimeManager;
private readonly ILoggerFactory _loggerFactory;
- private readonly ILogger> _logger;
+ private readonly ILogger> _logger;
private readonly IHubProtocolResolver _protocolResolver;
private readonly HubOptions _hubOptions;
private readonly HubOptions _globalHubOptions;
private readonly IUserIdProvider _userIdProvider;
private readonly HubDispatcher _dispatcher;
- public HubEndPoint(HubLifetimeManager lifetimeManager,
- IHubProtocolResolver protocolResolver,
- IOptions globalHubOptions,
- IOptions> hubOptions,
- ILoggerFactory loggerFactory,
- IUserIdProvider userIdProvider,
- HubDispatcher dispatcher)
+ public HubConnectionHandler(HubLifetimeManager lifetimeManager,
+ IHubProtocolResolver protocolResolver,
+ IOptions globalHubOptions,
+ IOptions> hubOptions,
+ ILoggerFactory loggerFactory,
+ IUserIdProvider userIdProvider,
+ HubDispatcher dispatcher)
{
_protocolResolver = protocolResolver;
_lifetimeManager = lifetimeManager;
_loggerFactory = loggerFactory;
_hubOptions = hubOptions.Value;
_globalHubOptions = globalHubOptions.Value;
- _logger = loggerFactory.CreateLogger>();
+ _logger = loggerFactory.CreateLogger>();
_userIdProvider = userIdProvider;
_dispatcher = dispatcher;
}
diff --git a/src/Microsoft.AspNetCore.SignalR.Core/SignalRDependencyInjectionExtensions.cs b/src/Microsoft.AspNetCore.SignalR.Core/SignalRDependencyInjectionExtensions.cs
index 02f12060ee..7d3fc13fb3 100644
--- a/src/Microsoft.AspNetCore.SignalR.Core/SignalRDependencyInjectionExtensions.cs
+++ b/src/Microsoft.AspNetCore.SignalR.Core/SignalRDependencyInjectionExtensions.cs
@@ -15,7 +15,7 @@ namespace Microsoft.Extensions.DependencyInjection
services.AddSingleton(typeof(IHubProtocolResolver), typeof(DefaultHubProtocolResolver));
services.AddSingleton(typeof(IHubContext<>), typeof(HubContext<>));
services.AddSingleton(typeof(IHubContext<,>), typeof(HubContext<,>));
- services.AddSingleton(typeof(HubEndPoint<>), typeof(HubEndPoint<>));
+ services.AddSingleton(typeof(HubConnectionHandler<>), typeof(HubConnectionHandler<>));
services.AddSingleton(typeof(IUserIdProvider), typeof(DefaultUserIdProvider));
services.AddSingleton(typeof(HubDispatcher<>), typeof(DefaultHubDispatcher<>));
services.AddScoped(typeof(IHubActivator<>), typeof(DefaultHubActivator<>));
diff --git a/src/Microsoft.AspNetCore.SignalR.Core/SignalRSocketBuilderExtensions.cs b/src/Microsoft.AspNetCore.SignalR.Core/SignalRSocketBuilderExtensions.cs
index a1e0e5f5e6..ed90edea45 100644
--- a/src/Microsoft.AspNetCore.SignalR.Core/SignalRSocketBuilderExtensions.cs
+++ b/src/Microsoft.AspNetCore.SignalR.Core/SignalRSocketBuilderExtensions.cs
@@ -1,7 +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.Connections;
using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.DependencyInjection;
@@ -9,10 +9,9 @@ namespace Microsoft.AspNetCore.SignalR
{
public static class SignalRSocketBuilderExtensions
{
- public static IConnectionBuilder UseHub(this IConnectionBuilder socketBuilder) where THub : Hub
+ public static IConnectionBuilder UseHub(this IConnectionBuilder connectionBuilder) where THub : Hub
{
- var endpoint = socketBuilder.ApplicationServices.GetRequiredService>();
- return socketBuilder.Run(connection => endpoint.OnConnectedAsync(connection));
+ return connectionBuilder.UseConnectionHandler>();
}
}
}
diff --git a/src/Microsoft.AspNetCore.SignalR.Protocols.MsgPack/Internal/Protocol/MessagePackHubProtocol.cs b/src/Microsoft.AspNetCore.SignalR.Protocols.MsgPack/Internal/Protocol/MessagePackHubProtocol.cs
index 07b84e923d..59d4a93ec7 100644
--- a/src/Microsoft.AspNetCore.SignalR.Protocols.MsgPack/Internal/Protocol/MessagePackHubProtocol.cs
+++ b/src/Microsoft.AspNetCore.SignalR.Protocols.MsgPack/Internal/Protocol/MessagePackHubProtocol.cs
@@ -7,7 +7,7 @@ using System.Diagnostics;
using System.IO;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Microsoft.Extensions.Options;
using MsgPack;
diff --git a/src/Microsoft.AspNetCore.SignalR/HubRouteBuilder.cs b/src/Microsoft.AspNetCore.SignalR/HubRouteBuilder.cs
index 97463258e9..e6ea9c2566 100644
--- a/src/Microsoft.AspNetCore.SignalR/HubRouteBuilder.cs
+++ b/src/Microsoft.AspNetCore.SignalR/HubRouteBuilder.cs
@@ -11,35 +11,35 @@ namespace Microsoft.AspNetCore.SignalR
{
public class HubRouteBuilder
{
- private readonly SocketRouteBuilder _routes;
+ private readonly ConnectionsRouteBuilder _routes;
- public HubRouteBuilder(SocketRouteBuilder routes)
+ public HubRouteBuilder(ConnectionsRouteBuilder routes)
{
_routes = routes;
}
public void MapHub(string path) where THub : Hub
{
- MapHub(new PathString(path), socketOptions: null);
+ MapHub(new PathString(path), configureOptions: null);
}
public void MapHub(PathString path) where THub : Hub
{
- MapHub(path, socketOptions: null);
+ MapHub(path, configureOptions: null);
}
- public void MapHub(PathString path, Action socketOptions) where THub : Hub
+ public void MapHub(PathString path, Action configureOptions) where THub : Hub
{
// find auth attributes
var authorizeAttributes = typeof(THub).GetCustomAttributes(inherit: true);
- var options = new HttpSocketOptions();
+ var options = new HttpConnectionOptions();
foreach (var attribute in authorizeAttributes)
{
options.AuthorizationData.Add(attribute);
}
- socketOptions?.Invoke(options);
+ configureOptions?.Invoke(options);
- _routes.MapSocket(path, options, builder =>
+ _routes.MapConnections(path, options, builder =>
{
builder.UseHub();
});
diff --git a/src/Microsoft.AspNetCore.SignalR/SignalRAppBuilderExtensions.cs b/src/Microsoft.AspNetCore.SignalR/SignalRAppBuilderExtensions.cs
index 954a18087c..d687ad2701 100644
--- a/src/Microsoft.AspNetCore.SignalR/SignalRAppBuilderExtensions.cs
+++ b/src/Microsoft.AspNetCore.SignalR/SignalRAppBuilderExtensions.cs
@@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Builder
"calling 'IServiceCollection.AddSignalR()'.");
}
- app.UseSockets(routes =>
+ app.UseConnections(routes =>
{
configure(new HubRouteBuilder(routes));
});
diff --git a/src/Microsoft.AspNetCore.SignalR/SignalRDependencyInjectionExtensions.cs b/src/Microsoft.AspNetCore.SignalR/SignalRDependencyInjectionExtensions.cs
index 5872ff392c..ae2498ecde 100644
--- a/src/Microsoft.AspNetCore.SignalR/SignalRDependencyInjectionExtensions.cs
+++ b/src/Microsoft.AspNetCore.SignalR/SignalRDependencyInjectionExtensions.cs
@@ -11,7 +11,7 @@ namespace Microsoft.Extensions.DependencyInjection
{
public static ISignalRBuilder AddSignalR(this IServiceCollection services)
{
- services.AddSockets();
+ services.AddConnections();
services.AddSingleton();
services.AddSingleton, HubOptionsSetup>();
return services.AddSignalRCore()
diff --git a/src/Microsoft.AspNetCore.Sockets.Abstractions/ConnectionBuilderExtensions.cs b/src/Microsoft.AspNetCore.Sockets.Abstractions/ConnectionBuilderExtensions.cs
deleted file mode 100644
index cc438b74bc..0000000000
--- a/src/Microsoft.AspNetCore.Sockets.Abstractions/ConnectionBuilderExtensions.cs
+++ /dev/null
@@ -1,23 +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 Microsoft.AspNetCore.Protocols;
-
-namespace Microsoft.AspNetCore.Sockets
-{
- public static class ConnectionBuilderExtensions
- {
- public static IConnectionBuilder UseEndPoint(this IConnectionBuilder connectionBuilder) where TEndPoint : EndPoint
- {
- var endpoint = (TEndPoint)connectionBuilder.ApplicationServices.GetService(typeof(TEndPoint));
-
- if (endpoint == null)
- {
- throw new InvalidOperationException($"{nameof(EndPoint)} type {typeof(TEndPoint)} is not registered.");
- }
- // This is a terminal middleware, so there's no need to use the 'next' parameter
- return connectionBuilder.Run(connection => endpoint.OnConnectedAsync(connection));
- }
- }
-}
diff --git a/src/Microsoft.AspNetCore.Sockets.Abstractions/DefaultConnectionContext.cs b/src/Microsoft.AspNetCore.Sockets.Abstractions/DefaultConnectionContext.cs
index 693fb74312..cf61973cda 100644
--- a/src/Microsoft.AspNetCore.Sockets.Abstractions/DefaultConnectionContext.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Abstractions/DefaultConnectionContext.cs
@@ -8,8 +8,8 @@ using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
-using Microsoft.AspNetCore.Protocols;
-using Microsoft.AspNetCore.Protocols.Features;
+using Microsoft.AspNetCore.Connections;
+using Microsoft.AspNetCore.Connections.Features;
namespace Microsoft.AspNetCore.Sockets
{
diff --git a/src/Microsoft.AspNetCore.Sockets.Abstractions/EndPoint.cs b/src/Microsoft.AspNetCore.Sockets.Abstractions/EndPoint.cs
deleted file mode 100644
index 89de4b79fa..0000000000
--- a/src/Microsoft.AspNetCore.Sockets.Abstractions/EndPoint.cs
+++ /dev/null
@@ -1,21 +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.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
-
-namespace Microsoft.AspNetCore.Sockets
-{
- ///
- /// Represents an end point that multiple connections connect to. For HTTP, endpoints are URLs, for non HTTP it can be a TCP listener (or similar)
- ///
- public abstract class EndPoint
- {
- ///
- /// Called when a new connection is accepted to the endpoint
- ///
- /// The new
- /// A that represents the connection lifetime. When the task completes, the connection is complete.
- public abstract Task OnConnectedAsync(ConnectionContext connection);
- }
-}
diff --git a/src/Microsoft.AspNetCore.Sockets.Abstractions/Features/ConnectionInherentKeepAliveFeature.cs b/src/Microsoft.AspNetCore.Sockets.Abstractions/Features/ConnectionInherentKeepAliveFeature.cs
index 7de46e5385..c5785c3450 100644
--- a/src/Microsoft.AspNetCore.Sockets.Abstractions/Features/ConnectionInherentKeepAliveFeature.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Abstractions/Features/ConnectionInherentKeepAliveFeature.cs
@@ -3,7 +3,7 @@
using System;
-namespace Microsoft.AspNetCore.Protocols.Features
+namespace Microsoft.AspNetCore.Connections.Features
{
public class ConnectionInherentKeepAliveFeature : IConnectionInherentKeepAliveFeature
{
diff --git a/src/Microsoft.AspNetCore.Sockets.Abstractions/IConnection.cs b/src/Microsoft.AspNetCore.Sockets.Abstractions/IConnection.cs
index 5f6a558f1a..b5605c96f8 100644
--- a/src/Microsoft.AspNetCore.Sockets.Abstractions/IConnection.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Abstractions/IConnection.cs
@@ -5,7 +5,7 @@ using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
namespace Microsoft.AspNetCore.Sockets.Client
{
diff --git a/src/Microsoft.AspNetCore.Sockets.Abstractions/Microsoft.AspNetCore.Sockets.Abstractions.csproj b/src/Microsoft.AspNetCore.Sockets.Abstractions/Microsoft.AspNetCore.Sockets.Abstractions.csproj
index 78df076a72..94f6277253 100644
--- a/src/Microsoft.AspNetCore.Sockets.Abstractions/Microsoft.AspNetCore.Sockets.Abstractions.csproj
+++ b/src/Microsoft.AspNetCore.Sockets.Abstractions/Microsoft.AspNetCore.Sockets.Abstractions.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.Log.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.Log.cs
index 00dc83ffdb..bb6433c34a 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.Log.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.Log.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Sockets.Client
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.cs
index 3adf223633..3c6351e9a0 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.cs
@@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets.Client.Http;
using Microsoft.AspNetCore.Sockets.Client.Internal;
using Microsoft.AspNetCore.Sockets.Http.Internal;
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/ITransport.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/ITransport.cs
index 411a7d0925..9f6e3cfeb9 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/ITransport.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/ITransport.cs
@@ -4,7 +4,7 @@
using System;
using System.Threading.Tasks;
using System.IO.Pipelines;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
namespace Microsoft.AspNetCore.Sockets.Client
{
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/LongPollingTransport.Log.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/LongPollingTransport.Log.cs
index 5148cf73fd..6d0df576e5 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/LongPollingTransport.Log.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/LongPollingTransport.Log.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Sockets.Client
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/LongPollingTransport.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/LongPollingTransport.cs
index d946f67704..f702a2f33c 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/LongPollingTransport.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/LongPollingTransport.cs
@@ -8,10 +8,10 @@ using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Sockets.Client.Http;
-using Microsoft.AspNetCore.Protocols.Features;
+using Microsoft.AspNetCore.Connections.Features;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
namespace Microsoft.AspNetCore.Sockets.Client
{
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/Microsoft.AspNetCore.Sockets.Client.Http.csproj b/src/Microsoft.AspNetCore.Sockets.Client.Http/Microsoft.AspNetCore.Sockets.Client.Http.csproj
index afab54c3f3..3d367e968f 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/Microsoft.AspNetCore.Sockets.Client.Http.csproj
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/Microsoft.AspNetCore.Sockets.Client.Http.csproj
@@ -21,9 +21,6 @@
-
-
-
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.Log.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.Log.cs
index df8e93360a..10414a88e5 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.Log.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.Log.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Sockets.Client
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.cs
index 8d819d6cbd..922d5fddbd 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.cs
@@ -7,7 +7,7 @@ using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets.Client.Http;
using Microsoft.AspNetCore.Sockets.Internal.Formatters;
using Microsoft.Extensions.Logging;
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.Log.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.Log.cs
index d182d0daa7..4d06ca2412 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.Log.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.Log.cs
@@ -3,7 +3,7 @@
using System;
using System.Net.WebSockets;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Sockets.Client
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.cs
index 8475dc7e23..e54e4d99d9 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.cs
@@ -9,7 +9,7 @@ using System.Net.WebSockets;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets.Client.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/Microsoft.AspNetCore.Sockets.Http/SocketsAppBuilderExtensions.cs b/src/Microsoft.AspNetCore.Sockets.Http/ConnectionsAppBuilderExtensions.cs
similarity index 71%
rename from src/Microsoft.AspNetCore.Sockets.Http/SocketsAppBuilderExtensions.cs
rename to src/Microsoft.AspNetCore.Sockets.Http/ConnectionsAppBuilderExtensions.cs
index f9baeb883c..e97b0e5ecb 100644
--- a/src/Microsoft.AspNetCore.Sockets.Http/SocketsAppBuilderExtensions.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Http/ConnectionsAppBuilderExtensions.cs
@@ -8,15 +8,15 @@ using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Builder
{
- public static class SocketsAppBuilderExtensions
+ public static class ConnectionsAppBuilderExtensions
{
- public static IApplicationBuilder UseSockets(this IApplicationBuilder app, Action callback)
+ public static IApplicationBuilder UseConnections(this IApplicationBuilder app, Action callback)
{
var dispatcher = app.ApplicationServices.GetRequiredService();
var routes = new RouteBuilder(app);
- callback(new SocketRouteBuilder(routes, dispatcher));
+ callback(new ConnectionsRouteBuilder(routes, dispatcher));
app.UseWebSockets();
app.UseRouter(routes.Build());
diff --git a/src/Microsoft.AspNetCore.Sockets.Http/SocketsDependencyInjectionExtensions.cs b/src/Microsoft.AspNetCore.Sockets.Http/ConnectionsDependencyInjectionExtensions.cs
similarity index 79%
rename from src/Microsoft.AspNetCore.Sockets.Http/SocketsDependencyInjectionExtensions.cs
rename to src/Microsoft.AspNetCore.Sockets.Http/ConnectionsDependencyInjectionExtensions.cs
index 96c7044ddc..bd5cdfc1e0 100644
--- a/src/Microsoft.AspNetCore.Sockets.Http/SocketsDependencyInjectionExtensions.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Http/ConnectionsDependencyInjectionExtensions.cs
@@ -6,9 +6,9 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Microsoft.Extensions.DependencyInjection
{
- public static class SocketsDependencyInjectionExtensions
+ public static class ConnectionsDependencyInjectionExtensions
{
- public static IServiceCollection AddSockets(this IServiceCollection services)
+ public static IServiceCollection AddConnections(this IServiceCollection services)
{
services.AddRouting();
services.AddAuthorizationPolicyEvaluator();
diff --git a/src/Microsoft.AspNetCore.Sockets.Http/ConnectionsRouteBuilder.cs b/src/Microsoft.AspNetCore.Sockets.Http/ConnectionsRouteBuilder.cs
new file mode 100644
index 0000000000..0d66ba04ab
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Sockets.Http/ConnectionsRouteBuilder.cs
@@ -0,0 +1,65 @@
+// 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.Reflection;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Connections;
+using Microsoft.AspNetCore.Routing;
+
+namespace Microsoft.AspNetCore.Sockets
+{
+ public class ConnectionsRouteBuilder
+ {
+ private readonly HttpConnectionDispatcher _dispatcher;
+ private readonly RouteBuilder _routes;
+
+ public ConnectionsRouteBuilder(RouteBuilder routes, HttpConnectionDispatcher dispatcher)
+ {
+ _routes = routes;
+ _dispatcher = dispatcher;
+ }
+
+ public void MapConnections(string path, Action configure) =>
+ MapConnections(new PathString(path), new HttpConnectionOptions(), configure);
+
+ public void MapConnections(PathString path, Action configure) =>
+ MapConnections(path, new HttpConnectionOptions(), configure);
+
+ public void MapConnections(PathString path, HttpConnectionOptions options, Action configure)
+ {
+ var connectionBuilder = new ConnectionBuilder(_routes.ServiceProvider);
+ configure(connectionBuilder);
+ var socket = connectionBuilder.Build();
+ _routes.MapRoute(path, c => _dispatcher.ExecuteAsync(c, options, socket));
+ _routes.MapRoute(path + "/negotiate", c => _dispatcher.ExecuteNegotiateAsync(c, options));
+ }
+
+ public void MapConnectionHandler(string path) where TConnectionHandler : ConnectionHandler
+ {
+ MapConnectionHandler(new PathString(path), configureOptions: null);
+ }
+
+ public void MapConnectionHandler(PathString path) where TConnectionHandler : ConnectionHandler
+ {
+ MapConnectionHandler(path, configureOptions: null);
+ }
+
+ public void MapConnectionHandler(PathString path, Action configureOptions) where TConnectionHandler : ConnectionHandler
+ {
+ var authorizeAttributes = typeof(TConnectionHandler).GetCustomAttributes(inherit: true);
+ var options = new HttpConnectionOptions();
+ foreach (var attribute in authorizeAttributes)
+ {
+ options.AuthorizationData.Add(attribute);
+ }
+ configureOptions?.Invoke(options);
+
+ MapConnections(path, options, builder =>
+ {
+ builder.UseConnectionHandler();
+ });
+ }
+ }
+}
diff --git a/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionContextExtensions.cs b/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionContextExtensions.cs
index 67a4d968d6..d0b1fa339c 100644
--- a/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionContextExtensions.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionContextExtensions.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets.Http.Features;
namespace Microsoft.AspNetCore.Sockets
diff --git a/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionDispatcher.Log.cs b/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionDispatcher.Log.cs
index 1cdc33e490..1bb37df6c0 100644
--- a/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionDispatcher.Log.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionDispatcher.Log.cs
@@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Sockets
LoggerMessage.Define(LogLevel.Trace, new EventId(6, "ReceivedBytes"), "Received {Count} bytes.");
private static readonly Action _transportNotSupported =
- LoggerMessage.Define(LogLevel.Debug, new EventId(7, "TransportNotSupported"), "{TransportType} transport not supported by this endpoint type.");
+ LoggerMessage.Define(LogLevel.Debug, new EventId(7, "TransportNotSupported"), "{TransportType} transport not supported by this connection handler.");
private static readonly Action _cannotChangeTransport =
LoggerMessage.Define(LogLevel.Error, new EventId(8, "CannotChangeTransport"), "Cannot change transports mid-connection; currently using {TransportType}, requesting {RequestedTransport}.");
diff --git a/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionDispatcher.cs b/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionDispatcher.cs
index 5b08db7a9e..19d3d35597 100644
--- a/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionDispatcher.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionDispatcher.cs
@@ -12,8 +12,8 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Http.Internal;
-using Microsoft.AspNetCore.Protocols;
-using Microsoft.AspNetCore.Protocols.Features;
+using Microsoft.AspNetCore.Connections;
+using Microsoft.AspNetCore.Connections.Features;
using Microsoft.AspNetCore.Sockets.Internal;
using Microsoft.AspNetCore.Sockets.Internal.Transports;
using Microsoft.Extensions.Logging;
@@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Sockets
_logger = _loggerFactory.CreateLogger();
}
- public async Task ExecuteAsync(HttpContext context, HttpSocketOptions options, ConnectionDelegate connectionDelegate)
+ public async Task ExecuteAsync(HttpContext context, HttpConnectionOptions 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
@@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Sockets
else if (HttpMethods.IsGet(context.Request.Method))
{
// GET /{path}
- await ExecuteEndpointAsync(context, connectionDelegate, options, logScope);
+ await ExecuteAsync(context, connectionDelegate, options, logScope);
}
else
{
@@ -66,7 +66,7 @@ namespace Microsoft.AspNetCore.Sockets
}
}
- public async Task ExecuteNegotiateAsync(HttpContext context, HttpSocketOptions options)
+ public async Task ExecuteNegotiateAsync(HttpContext context, HttpConnectionOptions options)
{
// Create the log scope and the scope connectionId param will be set when the connection is created.
var logScope = new ConnectionLogScope(connectionId: string.Empty);
@@ -90,7 +90,7 @@ namespace Microsoft.AspNetCore.Sockets
}
}
- private async Task ExecuteEndpointAsync(HttpContext context, ConnectionDelegate connectionDelegate, HttpSocketOptions options, ConnectionLogScope logScope)
+ private async Task ExecuteAsync(HttpContext context, ConnectionDelegate connectionDelegate, HttpConnectionOptions options, ConnectionLogScope logScope)
{
var supportedTransports = options.Transports;
@@ -356,7 +356,7 @@ namespace Microsoft.AspNetCore.Sockets
await connectionDelegate(connection);
}
- private Task ProcessNegotiate(HttpContext context, HttpSocketOptions options, ConnectionLogScope logScope)
+ private Task ProcessNegotiate(HttpContext context, HttpConnectionOptions options, ConnectionLogScope logScope)
{
context.Response.ContentType = "application/json";
@@ -377,7 +377,7 @@ namespace Microsoft.AspNetCore.Sockets
return context.Response.Body.WriteAsync(negotiateResponseBuffer, 0, negotiateResponseBuffer.Length);
}
- private static string GetNegotiatePayload(string connectionId, HttpContext context, HttpSocketOptions options)
+ private static string GetNegotiatePayload(string connectionId, HttpContext context, HttpConnectionOptions options)
{
var sb = new StringBuilder();
using (var jsonWriter = new JsonTextWriter(new StringWriter(sb)))
@@ -441,7 +441,7 @@ namespace Microsoft.AspNetCore.Sockets
private static string GetConnectionId(HttpContext context) => context.Request.Query["id"];
- private async Task ProcessSend(HttpContext context, HttpSocketOptions options)
+ private async Task ProcessSend(HttpContext context, HttpConnectionOptions options)
{
var connection = await GetConnectionAsync(context, options);
if (connection == null)
@@ -471,7 +471,7 @@ namespace Microsoft.AspNetCore.Sockets
await connection.Application.Output.FlushAsync();
}
- private async Task EnsureConnectionStateAsync(DefaultConnectionContext connection, HttpContext context, TransportType transportType, TransportType supportedTransports, ConnectionLogScope logScope, HttpSocketOptions options)
+ private async Task EnsureConnectionStateAsync(DefaultConnectionContext connection, HttpContext context, TransportType transportType, TransportType supportedTransports, ConnectionLogScope logScope, HttpConnectionOptions options)
{
if ((supportedTransports & transportType) == 0)
{
@@ -596,7 +596,7 @@ namespace Microsoft.AspNetCore.Sockets
return newHttpContext;
}
- private async Task GetConnectionAsync(HttpContext context, HttpSocketOptions options)
+ private async Task GetConnectionAsync(HttpContext context, HttpConnectionOptions options)
{
var connectionId = GetConnectionId(context);
@@ -623,7 +623,7 @@ namespace Microsoft.AspNetCore.Sockets
return connection;
}
- private void EnsureConnectionStateInternal(DefaultConnectionContext connection, HttpSocketOptions options)
+ private void EnsureConnectionStateInternal(DefaultConnectionContext connection, HttpConnectionOptions options)
{
// If the connection doesn't have a pipe yet then create one, we lazily create the pipe to save on allocations until the client actually connects
if (connection.Transport == null)
@@ -637,7 +637,7 @@ namespace Microsoft.AspNetCore.Sockets
}
// This is only used for WebSockets connections, which can connect directly without negotiating
- private async Task GetOrCreateConnectionAsync(HttpContext context, HttpSocketOptions options)
+ private async Task GetOrCreateConnectionAsync(HttpContext context, HttpConnectionOptions options)
{
var connectionId = GetConnectionId(context);
DefaultConnectionContext connection;
diff --git a/src/Microsoft.AspNetCore.Sockets.Http/HttpSocketOptions.cs b/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionOptions.cs
similarity index 95%
rename from src/Microsoft.AspNetCore.Sockets.Http/HttpSocketOptions.cs
rename to src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionOptions.cs
index ffc61d563f..c4ac05b09e 100644
--- a/src/Microsoft.AspNetCore.Sockets.Http/HttpSocketOptions.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Http/HttpConnectionOptions.cs
@@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Authorization;
namespace Microsoft.AspNetCore.Sockets
{
- public class HttpSocketOptions
+ public class HttpConnectionOptions
{
public IList AuthorizationData { get; } = new List();
diff --git a/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/WebSocketsTransport.cs b/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/WebSocketsTransport.cs
index 248c2993be..f86102228f 100644
--- a/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/WebSocketsTransport.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/WebSocketsTransport.cs
@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Sockets.Internal.Transports
diff --git a/src/Microsoft.AspNetCore.Sockets.Http/SocketRouteBuilder.cs b/src/Microsoft.AspNetCore.Sockets.Http/SocketRouteBuilder.cs
deleted file mode 100644
index 1afac841a2..0000000000
--- a/src/Microsoft.AspNetCore.Sockets.Http/SocketRouteBuilder.cs
+++ /dev/null
@@ -1,65 +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.Reflection;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Protocols;
-using Microsoft.AspNetCore.Routing;
-
-namespace Microsoft.AspNetCore.Sockets
-{
- public class SocketRouteBuilder
- {
- private readonly HttpConnectionDispatcher _dispatcher;
- private readonly RouteBuilder _routes;
-
- public SocketRouteBuilder(RouteBuilder routes, HttpConnectionDispatcher dispatcher)
- {
- _routes = routes;
- _dispatcher = dispatcher;
- }
-
- public void MapSocket(string path, Action socketConfig) =>
- MapSocket(new PathString(path), new HttpSocketOptions(), socketConfig);
-
- public void MapSocket(PathString path, Action socketConfig) =>
- MapSocket(path, new HttpSocketOptions(), socketConfig);
-
- public void MapSocket(PathString path, HttpSocketOptions options, Action connectionConfig)
- {
- var connectionBuilder = new ConnectionBuilder(_routes.ServiceProvider);
- connectionConfig(connectionBuilder);
- var socket = connectionBuilder.Build();
- _routes.MapRoute(path, c => _dispatcher.ExecuteAsync(c, options, socket));
- _routes.MapRoute(path + "/negotiate", c => _dispatcher.ExecuteNegotiateAsync(c, options));
- }
-
- public void MapEndPoint(string path) where TEndPoint : EndPoint
- {
- MapEndPoint(new PathString(path), socketOptions: null);
- }
-
- public void MapEndPoint(PathString path) where TEndPoint : EndPoint
- {
- MapEndPoint(path, socketOptions: null);
- }
-
- public void MapEndPoint(PathString path, Action socketOptions) where TEndPoint : EndPoint
- {
- var authorizeAttributes = typeof(TEndPoint).GetCustomAttributes(inherit: true);
- var options = new HttpSocketOptions();
- foreach (var attribute in authorizeAttributes)
- {
- options.AuthorizationData.Add(attribute);
- }
- socketOptions?.Invoke(options);
-
- MapSocket(path, options, builder =>
- {
- builder.UseEndPoint();
- });
- }
- }
-}
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.AbortAsync.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.AbortAsync.cs
index 349d5db667..20b9d457d5 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.AbortAsync.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.AbortAsync.cs
@@ -3,7 +3,7 @@
using System;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets;
using Xunit;
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.ConnectionLifecycle.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.ConnectionLifecycle.cs
index bff6c5b0af..310e777db2 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.ConnectionLifecycle.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.ConnectionLifecycle.cs
@@ -6,7 +6,7 @@ using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Client.Tests;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Client;
using Microsoft.Extensions.Logging.Testing;
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.Negotiate.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.Negotiate.cs
index 5e04044fa5..cdf3921efb 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.Negotiate.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.Negotiate.cs
@@ -5,7 +5,7 @@ using System;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Client.Tests;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Client;
using Moq;
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.OnReceived.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.OnReceived.cs
index 56b7b03fe3..3f71fe400b 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.OnReceived.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.OnReceived.cs
@@ -6,7 +6,7 @@ using System.Net;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Client.Tests;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets;
using Xunit;
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.SendAsync.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.SendAsync.cs
index a59fc103dd..968be6b051 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.SendAsync.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.SendAsync.cs
@@ -6,7 +6,7 @@ using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Client.Tests;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets;
using Xunit;
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.cs
index 9c76472215..613b892ffb 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HttpConnectionTests.cs
@@ -9,7 +9,7 @@ using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Client.Tests;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets.Client;
using Microsoft.AspNetCore.Sockets.Client.Http;
using Microsoft.Extensions.Logging;
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.cs
index ff77652f34..8206aa4dfd 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
using Microsoft.AspNetCore.Sockets.Client;
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/LongPollingTransportTests.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/LongPollingTransportTests.cs
index 2a76e1b37a..658a4e16f4 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/LongPollingTransportTests.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/LongPollingTransportTests.cs
@@ -13,7 +13,7 @@ using System.Text;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Client.Tests;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Client;
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/ResponseUtils.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/ResponseUtils.cs
index 5a3df4bed2..9734282c1a 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/ResponseUtils.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/ResponseUtils.cs
@@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets;
using Newtonsoft.Json;
using SocketsTransportType = Microsoft.AspNetCore.Sockets.TransportType;
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsTransportTests.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsTransportTests.cs
index a4955dbf48..1d684ae82f 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsTransportTests.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsTransportTests.cs
@@ -13,7 +13,7 @@ using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Client.Tests;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Client;
using Microsoft.AspNetCore.Sockets.Client.Http;
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestConnection.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestConnection.cs
index 20ef8418a3..c2ffc164e4 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestConnection.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestConnection.cs
@@ -9,7 +9,7 @@ using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Internal.Formatters;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
using Microsoft.AspNetCore.Sockets.Client;
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestTransport.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestTransport.cs
index 8e0c327771..1c35dedb6f 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestTransport.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestTransport.cs
@@ -1,7 +1,7 @@
using System;
using System.IO.Pipelines;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Client;
diff --git a/test/Microsoft.AspNetCore.SignalR.Tests.Utils/HubConnectionContextUtils.cs b/test/Microsoft.AspNetCore.SignalR.Tests.Utils/HubConnectionContextUtils.cs
index 88558e705b..d49e1f67ca 100644
--- a/test/Microsoft.AspNetCore.SignalR.Tests.Utils/HubConnectionContextUtils.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Tests.Utils/HubConnectionContextUtils.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
using Microsoft.AspNetCore.Sockets;
diff --git a/test/Microsoft.AspNetCore.SignalR.Tests.Utils/TestClient.cs b/test/Microsoft.AspNetCore.SignalR.Tests.Utils/TestClient.cs
index d3c82332c0..e4c6669446 100644
--- a/test/Microsoft.AspNetCore.SignalR.Tests.Utils/TestClient.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Tests.Utils/TestClient.cs
@@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
}
public async Task ConnectAsync(
- EndPoint endPoint,
+ Connections.ConnectionHandler handler,
bool sendHandshakeRequestMessage = true,
bool expectedHandshakeResponseMessage = true)
{
@@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
}
}
- var connection = endPoint.OnConnectedAsync(Connection);
+ var connection = handler.OnConnectedAsync(Connection);
if (expectedHandshakeResponseMessage)
{
diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/EchoEndPoint.cs b/test/Microsoft.AspNetCore.SignalR.Tests/EchoConnectionHandler.cs
similarity index 89%
rename from test/Microsoft.AspNetCore.SignalR.Tests/EchoEndPoint.cs
rename to test/Microsoft.AspNetCore.SignalR.Tests/EchoConnectionHandler.cs
index b7bedecc60..f9367ca2c6 100644
--- a/test/Microsoft.AspNetCore.SignalR.Tests/EchoEndPoint.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Tests/EchoConnectionHandler.cs
@@ -4,12 +4,12 @@
using System.Buffers;
using System.IO.Pipelines;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets;
namespace Microsoft.AspNetCore.SignalR.Tests
{
- public class EchoEndPoint : EndPoint
+ public class EchoConnectionHandler : ConnectionHandler
{
public override async Task OnConnectedAsync(ConnectionContext connection)
{
diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs b/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs
index 23113b6298..e51ba6489e 100644
--- a/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Tests/EndToEndTests.cs
@@ -9,7 +9,7 @@ using System.Net.WebSockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Client;
@@ -215,7 +215,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
catch (OperationCanceledException)
{
// Because the server and client are run in the same process there is a race where websocket.SendAsync
- // can send a message but before returning be suspended allowing the server to run the EchoEndpoint and
+ // can send a message but before returning be suspended allowing the server to run the EchoConnectionHandler and
// send a close frame which triggers a cancellation token on the client and cancels the websocket.SendAsync.
// Our solution to this is to just catch OperationCanceledException from the sent message if the race happens
// because we know the send went through, and its safe to check the response.
diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/HttpHeaderEndPoint.cs b/test/Microsoft.AspNetCore.SignalR.Tests/HttpHeaderConnectionHandler.cs
similarity index 92%
rename from test/Microsoft.AspNetCore.SignalR.Tests/HttpHeaderEndPoint.cs
rename to test/Microsoft.AspNetCore.SignalR.Tests/HttpHeaderConnectionHandler.cs
index 7fb3de2d05..7b6879f452 100644
--- a/test/Microsoft.AspNetCore.SignalR.Tests/HttpHeaderEndPoint.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Tests/HttpHeaderConnectionHandler.cs
@@ -7,13 +7,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Http.Features;
namespace Microsoft.AspNetCore.SignalR.Tests
{
- public class HttpHeaderEndPoint : EndPoint
+ public class HttpHeaderConnectionHandler : ConnectionHandler
{
public override async Task OnConnectedAsync(ConnectionContext connection)
{
diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/HubEndpointTests.cs b/test/Microsoft.AspNetCore.SignalR.Tests/HubConnectionHandlerTests.cs
similarity index 71%
rename from test/Microsoft.AspNetCore.SignalR.Tests/HubEndpointTests.cs
rename to test/Microsoft.AspNetCore.SignalR.Tests/HubConnectionHandlerTests.cs
index 7c44ffe8d4..1c5d3ba899 100644
--- a/test/Microsoft.AspNetCore.SignalR.Tests/HubEndpointTests.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Tests/HubConnectionHandlerTests.cs
@@ -10,10 +10,10 @@ using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Protocols;
+using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
-using Microsoft.AspNetCore.SignalR.Tests.HubEndpointTestUtils;
+using Microsoft.AspNetCore.SignalR.Tests;
using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
@@ -27,23 +27,23 @@ using Xunit;
namespace Microsoft.AspNetCore.SignalR.Tests
{
- public class HubEndpointTests
+ public class HubConnectionHandlerTests
{
[Fact]
public async Task HubsAreDisposed()
{
var trackDispose = new TrackDispose();
- var serviceProvider = HubEndPointTestUtils.CreateServiceProvider(s => s.AddSingleton(trackDispose));
- var endPoint = serviceProvider.GetService>();
+ var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(s => s.AddSingleton(trackDispose));
+ var connectionHandler = serviceProvider.GetService>();
using (var client = new TestClient())
{
- var endPointTask = await client.ConnectAsync(endPoint);
+ var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
// kill the connection
client.Dispose();
- await endPointTask;
+ await connectionHandlerTask;
Assert.Equal(2, trackDispose.DisposeCount);
}
@@ -53,17 +53,17 @@ namespace Microsoft.AspNetCore.SignalR.Tests
public async Task ConnectionAbortedTokenTriggers()
{
var state = new ConnectionLifetimeState();
- var serviceProvider = HubEndPointTestUtils.CreateServiceProvider(s => s.AddSingleton(state));
- var endPoint = serviceProvider.GetService>();
+ var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(s => s.AddSingleton(state));
+ var connectionHandler = serviceProvider.GetService>();
using (var client = new TestClient())
{
- var endPointTask = await client.ConnectAsync(endPoint);
+ var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
// kill the connection
client.Dispose();
- await endPointTask.OrTimeout();
+ await connectionHandlerTask.OrTimeout();
Assert.True(state.TokenCallbackTriggered);
Assert.False(state.TokenStateInConnected);
@@ -74,16 +74,16 @@ namespace Microsoft.AspNetCore.SignalR.Tests
[Fact]
public async Task AbortFromHubMethodForcesClientDisconnect()
{
- var serviceProvider = HubEndPointTestUtils.CreateServiceProvider();
- var endPoint = serviceProvider.GetService>();
+ var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider();
+ var connectionHandler = serviceProvider.GetService>();
using (var client = new TestClient())
{
- var endPointTask = await client.ConnectAsync(endPoint);
+ var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
await client.InvokeAsync(nameof(AbortHub.Kill));
- await endPointTask.OrTimeout();
+ await connectionHandlerTask.OrTimeout();
}
}
@@ -91,8 +91,8 @@ namespace Microsoft.AspNetCore.SignalR.Tests
public async Task ObservableHubRemovesSubscriptionsWithInfiniteStreams()
{
var observable = new Observable();
- var serviceProvider = HubEndPointTestUtils.CreateServiceProvider(s => s.AddSingleton(observable));
- var endPoint = serviceProvider.GetService>();
+ var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(s => s.AddSingleton(observable));
+ var connectionHandler = serviceProvider.GetService>();
var waitForSubscribe = new TaskCompletionSource