Renamed the project and split into class library and sample

This commit is contained in:
David Fowler 2016-10-01 00:43:33 -07:00
parent de291d4d2a
commit c3753c4f0e
24 changed files with 99 additions and 73 deletions

View File

@ -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

View File

@ -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

View File

@ -6,7 +6,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Channels; using Channels;
namespace WebApplication95 namespace Microsoft.AspNetCore.Sockets
{ {
public class Message public class Message
{ {

View File

@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Channels; using Channels;
using Microsoft.AspNetCore.Sockets;
namespace WebApplication95.EndPoints namespace SocketsSample
{ {
public class ChatEndPoint : EndPoint public class ChatEndPoint : EndPoint
{ {

View File

@ -5,17 +5,14 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
namespace WebApplication95 namespace SocketsSample
{ {
public class Program public class Program
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseKestrel(options => .UseKestrel()
{
options.UseConnectionLogging();
})
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration() .UseIISIntegration()
.UseStartup<Startup>() .UseStartup<Startup>()

View File

@ -7,8 +7,8 @@
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>52ed8b3a-2dbb-448a-a708-faa0783b7917</ProjectGuid> <ProjectGuid>c4aeab04-f341-4539-b6c0-52368fb4bf9e</ProjectGuid>
<RootNamespace>WebApplication95</RootNamespace> <RootNamespace>SocketsSample</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>

View File

@ -3,10 +3,8 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using WebApplication95.EndPoints;
using WebApplication95.Routing;
namespace WebApplication95 namespace SocketsSample
{ {
public class Startup public class Startup
{ {

View File

@ -1,14 +1,14 @@
{ {
"dependencies": { "dependencies": {
"Channels": "0.2.0-beta-*", "Microsoft.AspNetCore.Sockets": {
"target": "project"
},
"Microsoft.NETCore.App": { "Microsoft.NETCore.App": {
"version": "1.0.0", "version": "1.0.0",
"type": "platform" "type": "platform"
}, },
"Microsoft.AspNetCore.Routing": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0", "Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0" "Microsoft.Extensions.Logging.Console": "1.0.0"

View File

@ -3,7 +3,7 @@ using System.Collections.Concurrent;
using System.Threading; using System.Threading;
using Channels; using Channels;
namespace WebApplication95 namespace Microsoft.AspNetCore.Sockets
{ {
public class ConnectionManager public class ConnectionManager
{ {

View File

@ -1,7 +1,7 @@
using System; using System;
using Channels; using Channels;
namespace WebApplication95 namespace Microsoft.AspNetCore.Sockets
{ {
public class ConnectionState public class ConnectionState
{ {

View File

@ -1,10 +1,6 @@
using System; using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Channels;
namespace WebApplication95 namespace Microsoft.AspNetCore.Sockets
{ {
/// <summary> /// <summary>
/// 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) /// 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)

View File

@ -1,7 +1,7 @@
using System; using System;
using Channels; using Channels;
namespace WebApplication95 namespace Microsoft.AspNetCore.Sockets
{ {
public class HttpChannel : IChannel public class HttpChannel : IChannel
{ {

View File

@ -6,11 +6,11 @@ using Channels;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Sockets.Routing;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Primitives;
using WebApplication95.Routing;
namespace WebApplication95 namespace Microsoft.AspNetCore.Sockets
{ {
public class HttpConnectionDispatcher public class HttpConnectionDispatcher
{ {

View File

@ -1,10 +1,7 @@
using System; using System;
using System.Collections.Generic; using Microsoft.AspNetCore.Sockets;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
namespace WebApplication95 namespace Microsoft.AspNetCore.Builder
{ {
public static class HttpDispatcherAppBuilderExtensions public static class HttpDispatcherAppBuilderExtensions
{ {
@ -16,5 +13,4 @@ namespace WebApplication95
return app; return app;
} }
} }
} }

View File

@ -4,7 +4,7 @@ using System.Threading.Tasks;
using Channels; using Channels;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
namespace WebApplication95 namespace Microsoft.AspNetCore.Sockets
{ {
public class LongPolling public class LongPolling
{ {

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>1715ea8d-8e13-4acf-8bca-57d048e55ed8</ProjectGuid>
<RootNamespace>Microsoft.AspNetCore.Sockets</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -4,9 +4,9 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Routing; 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 IRouteHandler _target;
private readonly string _prefix; private readonly string _prefix;

View File

@ -4,10 +4,9 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
namespace WebApplication95.Routing namespace Microsoft.AspNetCore.Sockets.Routing
{ {
internal static class RouteBuilderExtensions
public static class RouteBuilderExtensions
{ {
public static IRouteBuilder AddPrefixRoute( public static IRouteBuilder AddPrefixRoute(
this IRouteBuilder routeBuilder, this IRouteBuilder routeBuilder,

View File

@ -3,7 +3,7 @@ using System.Threading.Tasks;
using Channels; using Channels;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
namespace WebApplication95 namespace Microsoft.AspNetCore.Sockets
{ {
public class ServerSentEvents public class ServerSentEvents
{ {
@ -94,7 +94,7 @@ namespace WebApplication95
{ {
return Post(async state => return Post(async state =>
{ {
var data = ((ReadableBuffer)state); var data = (ReadableBuffer)state;
// TODO: Pooled buffers // TODO: Pooled buffers
// 8 = 6(data: ) + 2 (\n\n) // 8 = 6(data: ) + 2 (\n\n)
var buffer = new byte[8 + data.Length]; var buffer = new byte[8 + data.Length];

View File

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using Channels; using Channels;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
namespace WebApplication95 namespace Microsoft.AspNetCore.Sockets
{ {
public class WebSockets public class WebSockets
{ {

View File

@ -0,0 +1,11 @@
{
"version": "0.1.0-*",
"dependencies": {
"Channels": "0.2.0-beta-*",
"Microsoft.AspNetCore.Routing": "1.0.0"
},
"frameworks": {
"netstandard1.3": {
}
}
}