Make a SignalR project and SignalR.Redis project

- Moved RPC into SignalR for now since we don't have a middle layer yet.
- Fixed up name spaces
This commit is contained in:
David Fowler 2016-11-02 01:49:05 -07:00
parent 915ebbda6b
commit 40039afd4f
30 changed files with 170 additions and 26 deletions

View File

@ -27,6 +27,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.WebSoc
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.WebSockets.Internal.Tests", "test\Microsoft.Extensions.WebSockets.Internal.Tests\Microsoft.Extensions.WebSockets.Internal.Tests.xproj", "{A7050BAE-3DB9-4FB3-A49D-303201415B13}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.SignalR", "src\Microsoft.AspNetCore.SignalR\Microsoft.AspNetCore.SignalR.xproj", "{42E76F87-92B6-45AB-BF07-6B811C0F2CAC}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.SignalR.Redis", "src\Microsoft.AspNetCore.SignalR.Redis\Microsoft.AspNetCore.SignalR.Redis.xproj", "{59319B72-38BE-4041-8E5C-FF6938874CE8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -57,6 +61,14 @@ Global
{A7050BAE-3DB9-4FB3-A49D-303201415B13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A7050BAE-3DB9-4FB3-A49D-303201415B13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A7050BAE-3DB9-4FB3-A49D-303201415B13}.Release|Any CPU.Build.0 = Release|Any CPU
{42E76F87-92B6-45AB-BF07-6B811C0F2CAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42E76F87-92B6-45AB-BF07-6B811C0F2CAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42E76F87-92B6-45AB-BF07-6B811C0F2CAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42E76F87-92B6-45AB-BF07-6B811C0F2CAC}.Release|Any CPU.Build.0 = Release|Any CPU
{59319B72-38BE-4041-8E5C-FF6938874CE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{59319B72-38BE-4041-8E5C-FF6938874CE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59319B72-38BE-4041-8E5C-FF6938874CE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{59319B72-38BE-4041-8E5C-FF6938874CE8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -68,5 +80,7 @@ Global
{AAD719D5-5E31-4ED1-A60F-6EB92EFA66D9} = {6A35B453-52EC-48AF-89CA-D4A69800F131}
{5D9DA986-2EAB-4C6D-BF15-9A4BDD4DE775} = {DA69F624-5398-4884-87E4-B816698CDE65}
{A7050BAE-3DB9-4FB3-A49D-303201415B13} = {6A35B453-52EC-48AF-89CA-D4A69800F131}
{42E76F87-92B6-45AB-BF07-6B811C0F2CAC} = {DA69F624-5398-4884-87E4-B816698CDE65}
{59319B72-38BE-4041-8E5C-FF6938874CE8} = {DA69F624-5398-4884-87E4-B816698CDE65}
EndGlobalSection
EndGlobal

View File

@ -1,5 +1,6 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection;
namespace SocketsSample

View File

@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
namespace SocketsSample.Hubs
{

View File

@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;
namespace SocketsSample

View File

@ -3,6 +3,7 @@ using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
namespace SocketsSample
{

View File

@ -2,6 +2,7 @@
using System.IO;
using System.Threading.Tasks;
using Google.Protobuf;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection;
namespace SocketsSample.Protobuf

View File

@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using SocketsSample.EndPoints.Hubs;
using SocketsSample.Hubs;
namespace SocketsSample
@ -15,10 +15,7 @@ namespace SocketsSample
{
services.AddRouting();
services.AddSingleton(typeof(HubLifetimeManager<>), typeof(DefaultHubLifetimeManager<>));
// services.AddSingleton(typeof(HubLifetimeManager<>), typeof(RedisHubLifetimeManager<>));
services.AddSingleton(typeof(HubEndPoint<>), typeof(HubEndPoint<>));
services.AddSingleton(typeof(RpcEndpoint<>), typeof(RpcEndpoint<>));
services.AddSignalR();
services.AddSingleton<ChatEndPoint>();
services.AddSingleton<ProtobufSerializer>();

View File

@ -1,5 +1,8 @@
{
"dependencies": {
"Microsoft.AspNetCore.SignalR": {
"target": "project"
},
"Microsoft.AspNetCore.Sockets": {
"target": "project"
},
@ -8,7 +11,6 @@
"type": "platform"
},
"Newtonsoft.Json": "9.0.1",
"StackExchange.Redis": "1.1.*",
"Microsoft.AspNetCore.Diagnostics": "1.1.0-*",
"Microsoft.AspNetCore.StaticFiles": "1.1.0-*",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-*",

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>59319b72-38be-4041-8e5c-ff6938874ce8</ProjectGuid>
<RootNamespace>Microsoft.AspNetCore.SignalR.Redis</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -0,0 +1,19 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.AspNetCore.SignalR.Redis")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("59319b72-38be-4041-8e5c-ff6938874ce8")]

View File

@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.Logging;
using StackExchange.Redis;
namespace SocketsSample.EndPoints.Hubs
namespace Microsoft.AspNetCore.SignalR.Redis
{
public class RedisHubLifetimeManager<THub> : HubLifetimeManager<THub>, IDisposable
{

View File

@ -0,0 +1,14 @@
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNetCore.SignalR": {
"target": "project"
},
"StackExchange.Redis": "1.1.*"
},
"frameworks": {
"netstandard1.6": {}
}
}

View File

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using Channels;
using Microsoft.AspNetCore.Sockets;
namespace SocketsSample.EndPoints.Hubs
namespace Microsoft.AspNetCore.SignalR
{
public class DefaultHubLifetimeManager<THub> : HubLifetimeManager<THub>
{

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.SignalR
{
public static class DependencyInjectionExtensions
{
// TODO: We might need a builder here for things like scaleout
public static IServiceCollection AddSignalR(this IServiceCollection services)
{
services.AddSingleton(typeof(HubLifetimeManager<>), typeof(DefaultHubLifetimeManager<>));
// services.AddSingleton(typeof(HubLifetimeManager<>), typeof(RedisHubLifetimeManager<>));
services.AddSingleton(typeof(HubEndPoint<>), typeof(HubEndPoint<>));
services.AddSingleton(typeof(RpcEndpoint<>), typeof(RpcEndpoint<>));
return services;
}
}
}

View File

@ -1,7 +1,7 @@
using System;
using System.Threading.Tasks;
namespace SocketsSample.Hubs
namespace Microsoft.AspNetCore.SignalR
{
public class Hub : IDisposable
{

View File

@ -1,7 +1,7 @@
using System.Security.Claims;
using Microsoft.AspNetCore.Sockets;
namespace SocketsSample.Hubs
namespace Microsoft.AspNetCore.SignalR
{
public class HubCallerContext
{

View File

@ -3,10 +3,8 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using SocketsSample.EndPoints.Hubs;
using SocketsSample.Hubs;
namespace SocketsSample
namespace Microsoft.AspNetCore.SignalR
{
public class HubEndPoint<THub> : RpcEndpoint<THub>, IHubConnectionContext where THub : Hub
{

View File

@ -1,7 +1,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Sockets;
namespace SocketsSample.EndPoints.Hubs
namespace Microsoft.AspNetCore.SignalR
{
public abstract class HubLifetimeManager<THub>
{

View File

@ -1,6 +1,6 @@
using System.Threading.Tasks;
namespace SocketsSample.Hubs
namespace Microsoft.AspNetCore.SignalR
{
public interface IClientProxy
{

View File

@ -1,4 +1,4 @@
namespace SocketsSample.Hubs
namespace Microsoft.AspNetCore.SignalR
{
public interface IGroupManager
{

View File

@ -1,4 +1,4 @@
namespace SocketsSample.Hubs
namespace Microsoft.AspNetCore.SignalR
{
public interface IHubConnectionContext
{

View File

@ -2,7 +2,7 @@
using System.IO;
using System.Threading.Tasks;
namespace SocketsSample
namespace Microsoft.AspNetCore.SignalR
{
public interface IInvocationAdapter
{

View File

@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.DependencyInjection;
namespace SocketsSample
namespace Microsoft.AspNetCore.SignalR
{
public class InvocationAdapterRegistry
{

View File

@ -1,6 +1,6 @@
using System;
namespace SocketsSample
namespace Microsoft.AspNetCore.SignalR
{
public class InvocationDescriptor
{

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SocketsSample
namespace Microsoft.AspNetCore.SignalR
{
public class InvocationResultDescriptor
{

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>42e76f87-92b6-45ab-bf07-6b811c0f2cac</ProjectGuid>
<RootNamespace>Microsoft.AspNetCore.SignalR</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -0,0 +1,19 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Microsoft.AspNetCore.SignalR")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("42e76f87-92b6-45ab-bf07-6b811c0f2cac")]

View File

@ -2,9 +2,8 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Sockets;
using SocketsSample.Hubs;
namespace SocketsSample.EndPoints.Hubs
namespace Microsoft.AspNetCore.SignalR
{
public class UserProxy<THub> : IClientProxy
{

View File

@ -8,8 +8,9 @@ using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace SocketsSample
namespace Microsoft.AspNetCore.SignalR
{
// REVIEW: Should there be an RPC package?
public class RpcEndpoint<T> : EndPoint where T : class
{
private readonly Dictionary<string, Func<Connection, InvocationDescriptor, InvocationResultDescriptor>> _callbacks

View File

@ -0,0 +1,14 @@
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNetCore.Sockets": {
"target": "project"
}
},
"frameworks": {
"netstandard1.6": {
}
}
}