diff --git a/Microsoft.AspNetCore.Sockets.sln b/Microsoft.AspNetCore.Sockets.sln new file mode 100644 index 0000000000..b481659f14 --- /dev/null +++ b/Microsoft.AspNetCore.Sockets.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DA69F624-5398-4884-87E4-B816698CDE65}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{83B2C3EB-A3D8-4E6F-9A3C-A380B005EF31}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{C4BC9889-B49F-41B6-806B-F84941B2549B}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SocketsSample", "samples\SocketsSample\SocketsSample.xproj", "{C4AEAB04-F341-4539-B6C0-52368FB4BF9E}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Sockets", "src\Microsoft.AspNetCore.Sockets\Microsoft.AspNetCore.Sockets.xproj", "{1715EA8D-8E13-4ACF-8BCA-57D048E55ED8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C4AEAB04-F341-4539-B6C0-52368FB4BF9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C4AEAB04-F341-4539-B6C0-52368FB4BF9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C4AEAB04-F341-4539-B6C0-52368FB4BF9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C4AEAB04-F341-4539-B6C0-52368FB4BF9E}.Release|Any CPU.Build.0 = Release|Any CPU + {1715EA8D-8E13-4ACF-8BCA-57D048E55ED8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1715EA8D-8E13-4ACF-8BCA-57D048E55ED8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1715EA8D-8E13-4ACF-8BCA-57D048E55ED8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1715EA8D-8E13-4ACF-8BCA-57D048E55ED8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {C4AEAB04-F341-4539-B6C0-52368FB4BF9E} = {C4BC9889-B49F-41B6-806B-F84941B2549B} + {1715EA8D-8E13-4ACF-8BCA-57D048E55ED8} = {DA69F624-5398-4884-87E4-B816698CDE65} + EndGlobalSection +EndGlobal diff --git a/WebApplication95.sln b/WebApplication95.sln deleted file mode 100644 index 607b118e87..0000000000 --- a/WebApplication95.sln +++ /dev/null @@ -1,32 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DA69F624-5398-4884-87E4-B816698CDE65}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{83B2C3EB-A3D8-4E6F-9A3C-A380B005EF31}" - ProjectSection(SolutionItems) = preProject - global.json = global.json - EndProjectSection -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication95", "src\WebApplication95\WebApplication95.xproj", "{52ED8B3A-2DBB-448A-A708-FAA0783B7917}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {52ED8B3A-2DBB-448A-A708-FAA0783B7917}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {52ED8B3A-2DBB-448A-A708-FAA0783B7917}.Debug|Any CPU.Build.0 = Debug|Any CPU - {52ED8B3A-2DBB-448A-A708-FAA0783B7917}.Release|Any CPU.ActiveCfg = Release|Any CPU - {52ED8B3A-2DBB-448A-A708-FAA0783B7917}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {52ED8B3A-2DBB-448A-A708-FAA0783B7917} = {DA69F624-5398-4884-87E4-B816698CDE65} - EndGlobalSection -EndGlobal diff --git a/src/WebApplication95/Bus.cs b/samples/SocketsSample/Bus.cs similarity index 97% rename from src/WebApplication95/Bus.cs rename to samples/SocketsSample/Bus.cs index b7be6e8818..2e13c2abc1 100644 --- a/src/WebApplication95/Bus.cs +++ b/samples/SocketsSample/Bus.cs @@ -6,7 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Channels; -namespace WebApplication95 +namespace Microsoft.AspNetCore.Sockets { public class Message { diff --git a/src/WebApplication95/EndPoints/ChatEndPoint.cs b/samples/SocketsSample/EndPoints/ChatEndPoint.cs similarity index 96% rename from src/WebApplication95/EndPoints/ChatEndPoint.cs rename to samples/SocketsSample/EndPoints/ChatEndPoint.cs index d4a9923aab..87d997d49e 100644 --- a/src/WebApplication95/EndPoints/ChatEndPoint.cs +++ b/samples/SocketsSample/EndPoints/ChatEndPoint.cs @@ -3,8 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Channels; +using Microsoft.AspNetCore.Sockets; -namespace WebApplication95.EndPoints +namespace SocketsSample { public class ChatEndPoint : EndPoint { diff --git a/src/WebApplication95/Program.cs b/samples/SocketsSample/Program.cs similarity index 76% rename from src/WebApplication95/Program.cs rename to samples/SocketsSample/Program.cs index be7ba38402..620f9b4c98 100644 --- a/src/WebApplication95/Program.cs +++ b/samples/SocketsSample/Program.cs @@ -5,17 +5,14 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; -namespace WebApplication95 +namespace SocketsSample { public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() - .UseKestrel(options => - { - options.UseConnectionLogging(); - }) + .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup() diff --git a/src/WebApplication95/WebApplication95.xproj b/samples/SocketsSample/SocketsSample.xproj similarity index 90% rename from src/WebApplication95/WebApplication95.xproj rename to samples/SocketsSample/SocketsSample.xproj index 85dbf4bbcb..755dafa8d7 100644 --- a/src/WebApplication95/WebApplication95.xproj +++ b/samples/SocketsSample/SocketsSample.xproj @@ -7,8 +7,8 @@ - 52ed8b3a-2dbb-448a-a708-faa0783b7917 - WebApplication95 + c4aeab04-f341-4539-b6c0-52368fb4bf9e + SocketsSample .\obj .\bin\ v4.5.2 diff --git a/src/WebApplication95/Startup.cs b/samples/SocketsSample/Startup.cs similarity index 92% rename from src/WebApplication95/Startup.cs rename to samples/SocketsSample/Startup.cs index 0845fb4f70..c2ea82a2ce 100644 --- a/src/WebApplication95/Startup.cs +++ b/samples/SocketsSample/Startup.cs @@ -3,10 +3,8 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using WebApplication95.EndPoints; -using WebApplication95.Routing; -namespace WebApplication95 +namespace SocketsSample { public class Startup { diff --git a/src/WebApplication95/project.json b/samples/SocketsSample/project.json similarity index 92% rename from src/WebApplication95/project.json rename to samples/SocketsSample/project.json index 241e3ec896..c260e8c160 100644 --- a/src/WebApplication95/project.json +++ b/samples/SocketsSample/project.json @@ -1,14 +1,14 @@ { "dependencies": { - "Channels": "0.2.0-beta-*", + "Microsoft.AspNetCore.Sockets": { + "target": "project" + }, "Microsoft.NETCore.App": { "version": "1.0.0", "type": "platform" }, - "Microsoft.AspNetCore.Routing": "1.0.0", "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.StaticFiles": "1.0.0", - "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", "Microsoft.Extensions.Logging.Console": "1.0.0" diff --git a/src/WebApplication95/web.config b/samples/SocketsSample/web.config similarity index 100% rename from src/WebApplication95/web.config rename to samples/SocketsSample/web.config diff --git a/src/WebApplication95/wwwroot/index.html b/samples/SocketsSample/wwwroot/index.html similarity index 100% rename from src/WebApplication95/wwwroot/index.html rename to samples/SocketsSample/wwwroot/index.html diff --git a/src/WebApplication95/wwwroot/polling.html b/samples/SocketsSample/wwwroot/polling.html similarity index 100% rename from src/WebApplication95/wwwroot/polling.html rename to samples/SocketsSample/wwwroot/polling.html diff --git a/src/WebApplication95/ConnectionManager.cs b/src/Microsoft.AspNetCore.Sockets/ConnectionManager.cs similarity index 98% rename from src/WebApplication95/ConnectionManager.cs rename to src/Microsoft.AspNetCore.Sockets/ConnectionManager.cs index 63419b6ee1..5b97e63fad 100644 --- a/src/WebApplication95/ConnectionManager.cs +++ b/src/Microsoft.AspNetCore.Sockets/ConnectionManager.cs @@ -3,7 +3,7 @@ using System.Collections.Concurrent; using System.Threading; using Channels; -namespace WebApplication95 +namespace Microsoft.AspNetCore.Sockets { public class ConnectionManager { diff --git a/src/WebApplication95/ConnectionState.cs b/src/Microsoft.AspNetCore.Sockets/ConnectionState.cs similarity index 90% rename from src/WebApplication95/ConnectionState.cs rename to src/Microsoft.AspNetCore.Sockets/ConnectionState.cs index d410a6cd16..00e0c2929f 100644 --- a/src/WebApplication95/ConnectionState.cs +++ b/src/Microsoft.AspNetCore.Sockets/ConnectionState.cs @@ -1,7 +1,7 @@ using System; using Channels; -namespace WebApplication95 +namespace Microsoft.AspNetCore.Sockets { public class ConnectionState { diff --git a/src/WebApplication95/EndPoint.cs b/src/Microsoft.AspNetCore.Sockets/EndPoint.cs similarity index 78% rename from src/WebApplication95/EndPoint.cs rename to src/Microsoft.AspNetCore.Sockets/EndPoint.cs index 188d166160..918723e62a 100644 --- a/src/WebApplication95/EndPoint.cs +++ b/src/Microsoft.AspNetCore.Sockets/EndPoint.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Channels; +using System.Threading.Tasks; -namespace WebApplication95 +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) diff --git a/src/WebApplication95/HttpChannel.cs b/src/Microsoft.AspNetCore.Sockets/HttpChannel.cs similarity index 94% rename from src/WebApplication95/HttpChannel.cs rename to src/Microsoft.AspNetCore.Sockets/HttpChannel.cs index bf1cb881c0..036bd6a68f 100644 --- a/src/WebApplication95/HttpChannel.cs +++ b/src/Microsoft.AspNetCore.Sockets/HttpChannel.cs @@ -1,7 +1,7 @@ using System; using Channels; -namespace WebApplication95 +namespace Microsoft.AspNetCore.Sockets { public class HttpChannel : IChannel { diff --git a/src/WebApplication95/HttpConnectionDispatcher.cs b/src/Microsoft.AspNetCore.Sockets/HttpConnectionDispatcher.cs similarity index 98% rename from src/WebApplication95/HttpConnectionDispatcher.cs rename to src/Microsoft.AspNetCore.Sockets/HttpConnectionDispatcher.cs index 5317863c65..2d3bf15e40 100644 --- a/src/WebApplication95/HttpConnectionDispatcher.cs +++ b/src/Microsoft.AspNetCore.Sockets/HttpConnectionDispatcher.cs @@ -6,11 +6,11 @@ using Channels; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; +using Microsoft.AspNetCore.Sockets.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Primitives; -using WebApplication95.Routing; -namespace WebApplication95 +namespace Microsoft.AspNetCore.Sockets { public class HttpConnectionDispatcher { diff --git a/src/WebApplication95/HttpDispatcherAppBuilderExtensions.cs b/src/Microsoft.AspNetCore.Sockets/HttpDispatcherAppBuilderExtensions.cs similarity index 73% rename from src/WebApplication95/HttpDispatcherAppBuilderExtensions.cs rename to src/Microsoft.AspNetCore.Sockets/HttpDispatcherAppBuilderExtensions.cs index 5fe35fb5db..0534695f72 100644 --- a/src/WebApplication95/HttpDispatcherAppBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.Sockets/HttpDispatcherAppBuilderExtensions.cs @@ -1,10 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Sockets; -namespace WebApplication95 +namespace Microsoft.AspNetCore.Builder { public static class HttpDispatcherAppBuilderExtensions { @@ -16,5 +13,4 @@ namespace WebApplication95 return app; } } - } diff --git a/src/WebApplication95/LongPolling.cs b/src/Microsoft.AspNetCore.Sockets/LongPolling.cs similarity index 98% rename from src/WebApplication95/LongPolling.cs rename to src/Microsoft.AspNetCore.Sockets/LongPolling.cs index 7711a64fd3..b9b61c443b 100644 --- a/src/WebApplication95/LongPolling.cs +++ b/src/Microsoft.AspNetCore.Sockets/LongPolling.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Channels; using Microsoft.AspNetCore.Http; -namespace WebApplication95 +namespace Microsoft.AspNetCore.Sockets { public class LongPolling { diff --git a/src/Microsoft.AspNetCore.Sockets/Microsoft.AspNetCore.Sockets.xproj b/src/Microsoft.AspNetCore.Sockets/Microsoft.AspNetCore.Sockets.xproj new file mode 100644 index 0000000000..d2f1ebabef --- /dev/null +++ b/src/Microsoft.AspNetCore.Sockets/Microsoft.AspNetCore.Sockets.xproj @@ -0,0 +1,19 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 1715ea8d-8e13-4acf-8bca-57d048e55ed8 + Microsoft.AspNetCore.Sockets + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/src/WebApplication95/Routing/PrefixRoute.cs b/src/Microsoft.AspNetCore.Sockets/Routing/PrefixRoute.cs similarity index 95% rename from src/WebApplication95/Routing/PrefixRoute.cs rename to src/Microsoft.AspNetCore.Sockets/Routing/PrefixRoute.cs index 177f7a1af2..df591481a3 100644 --- a/src/WebApplication95/Routing/PrefixRoute.cs +++ b/src/Microsoft.AspNetCore.Sockets/Routing/PrefixRoute.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Routing; -namespace WebApplication95.Routing +namespace Microsoft.AspNetCore.Sockets.Routing { - public class PrefixRoute : IRouter + internal class PrefixRoute : IRouter { private readonly IRouteHandler _target; private readonly string _prefix; diff --git a/src/WebApplication95/Routing/RouteBuilderExtensions.cs b/src/Microsoft.AspNetCore.Sockets/Routing/RouteBuilderExtensions.cs similarity index 81% rename from src/WebApplication95/Routing/RouteBuilderExtensions.cs rename to src/Microsoft.AspNetCore.Sockets/Routing/RouteBuilderExtensions.cs index 45d253efd8..2fab0a266e 100644 --- a/src/WebApplication95/Routing/RouteBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.Sockets/Routing/RouteBuilderExtensions.cs @@ -4,10 +4,9 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Routing; -namespace WebApplication95.Routing +namespace Microsoft.AspNetCore.Sockets.Routing { - - public static class RouteBuilderExtensions + internal static class RouteBuilderExtensions { public static IRouteBuilder AddPrefixRoute( this IRouteBuilder routeBuilder, diff --git a/src/WebApplication95/ServerSentEvents.cs b/src/Microsoft.AspNetCore.Sockets/ServerSentEvents.cs similarity index 97% rename from src/WebApplication95/ServerSentEvents.cs rename to src/Microsoft.AspNetCore.Sockets/ServerSentEvents.cs index 8c2a9b19ce..3d5740a5b4 100644 --- a/src/WebApplication95/ServerSentEvents.cs +++ b/src/Microsoft.AspNetCore.Sockets/ServerSentEvents.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using Channels; using Microsoft.AspNetCore.Http; -namespace WebApplication95 +namespace Microsoft.AspNetCore.Sockets { public class ServerSentEvents { @@ -94,7 +94,7 @@ namespace WebApplication95 { return Post(async state => { - var data = ((ReadableBuffer)state); + var data = (ReadableBuffer)state; // TODO: Pooled buffers // 8 = 6(data: ) + 2 (\n\n) var buffer = new byte[8 + data.Length]; diff --git a/src/WebApplication95/WebSockets.cs b/src/Microsoft.AspNetCore.Sockets/WebSockets.cs similarity index 98% rename from src/WebApplication95/WebSockets.cs rename to src/Microsoft.AspNetCore.Sockets/WebSockets.cs index 6af6029ad6..6b24c3ccbc 100644 --- a/src/WebApplication95/WebSockets.cs +++ b/src/Microsoft.AspNetCore.Sockets/WebSockets.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using Channels; using Microsoft.AspNetCore.Http; -namespace WebApplication95 +namespace Microsoft.AspNetCore.Sockets { public class WebSockets { diff --git a/src/Microsoft.AspNetCore.Sockets/project.json b/src/Microsoft.AspNetCore.Sockets/project.json new file mode 100644 index 0000000000..4fe87a4eaa --- /dev/null +++ b/src/Microsoft.AspNetCore.Sockets/project.json @@ -0,0 +1,11 @@ +{ + "version": "0.1.0-*", + "dependencies": { + "Channels": "0.2.0-beta-*", + "Microsoft.AspNetCore.Routing": "1.0.0" + }, + "frameworks": { + "netstandard1.3": { + } + } +}