Added Microsoft.AspNetCore.SignalR.Protocols.Json (#1861)

- Fixed package descriptions
- Call AddJsonProtocol from both the SignalR.Core (client and server)
This commit is contained in:
David Fowler 2018-04-05 01:32:10 -07:00 committed by GitHub
parent e9db9e64c7
commit 61c3d0c403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 43 additions and 18 deletions

View File

@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27110.0
MinimumVisualStudioVersion = 15.0.26730.03
@ -85,6 +85,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTests", "clients\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkServer", "benchmarks\BenchmarkServer\BenchmarkServer.csproj", "{B5286020-C218-443C-91A9-B65751FB9B29}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.SignalR.Protocols.Json", "src\Microsoft.AspNetCore.SignalR.Protocols.Json\Microsoft.AspNetCore.SignalR.Protocols.Json.csproj", "{896FA5EE-63A5-4EAC-9F09-346584BB4830}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -199,6 +201,10 @@ Global
{B5286020-C218-443C-91A9-B65751FB9B29}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5286020-C218-443C-91A9-B65751FB9B29}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5286020-C218-443C-91A9-B65751FB9B29}.Release|Any CPU.Build.0 = Release|Any CPU
{896FA5EE-63A5-4EAC-9F09-346584BB4830}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{896FA5EE-63A5-4EAC-9F09-346584BB4830}.Debug|Any CPU.Build.0 = Debug|Any CPU
{896FA5EE-63A5-4EAC-9F09-346584BB4830}.Release|Any CPU.ActiveCfg = Release|Any CPU
{896FA5EE-63A5-4EAC-9F09-346584BB4830}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -231,6 +237,7 @@ Global
{55DB4B6F-12E5-4A27-97F4-E97E135470FF} = {DA69F624-5398-4884-87E4-B816698CDE65}
{D0C7B22E-B0B6-4D62-BF7D-79EE4AAF1981} = {3A76C5A2-79ED-49BC-8BDC-6A3A766FFA1B}
{B5286020-C218-443C-91A9-B65751FB9B29} = {8A4582C8-DC59-4B61-BCE7-119FBAA99EFB}
{896FA5EE-63A5-4EAC-9F09-346584BB4830} = {DA69F624-5398-4884-87E4-B816698CDE65}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7945A4E4-ACDB-4F6E-95CA-6AC6E7C2CD59}

View File

@ -23,8 +23,8 @@ namespace Microsoft.AspNetCore.SignalR.Client
{
Services = new ServiceCollection();
Services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Services.AddSingleton<IHubProtocol, JsonHubProtocol>();
Services.AddSingleton<HubConnection>();
this.AddJsonProtocol();
}
public HubConnection Build()

View File

@ -13,6 +13,7 @@
<ItemGroup>
<ProjectReference Include="..\Microsoft.AspNetCore.SignalR.Common\Microsoft.AspNetCore.SignalR.Common.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.SignalR.Protocols.Json\Microsoft.AspNetCore.SignalR.Protocols.Json.csproj" />
</ItemGroup>
<ItemGroup>

View File

@ -7,9 +7,9 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
namespace Microsoft.AspNetCore.SignalR.Internal
{
internal class Utf8BufferTextReader : TextReader
public class Utf8BufferTextReader : TextReader
{
private readonly Decoder _decoder;
private ReadOnlySequence<byte> _utf8Buffer;

View File

@ -9,9 +9,9 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
namespace Microsoft.AspNetCore.SignalR.Internal
{
internal sealed class Utf8BufferTextWriter : TextWriter
public sealed class Utf8BufferTextWriter : TextWriter
{
private static readonly UTF8Encoding _utf8NoBom = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false);

View File

@ -8,6 +8,7 @@
<ItemGroup>
<ProjectReference Include="..\Microsoft.AspNetCore.SignalR.Common\Microsoft.AspNetCore.SignalR.Common.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.SignalR.Protocols.Json\Microsoft.AspNetCore.SignalR.Protocols.Json.csproj" />
</ItemGroup>
<ItemGroup>
@ -17,7 +18,6 @@
<PackageReference Include="Microsoft.Extensions.ClosedGenericMatcher.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.ObjectMethodExecutor.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion)" />
<PackageReference Include="System.Reflection.Emit" Version="$(SystemReflectionEmitPackageVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
<PackageReference Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" />
</ItemGroup>

View File

@ -19,10 +19,11 @@ namespace Microsoft.Extensions.DependencyInjection
services.AddSingleton(typeof(IUserIdProvider), typeof(DefaultUserIdProvider));
services.AddSingleton(typeof(HubDispatcher<>), typeof(DefaultHubDispatcher<>));
services.AddScoped(typeof(IHubActivator<>), typeof(DefaultHubActivator<>));
services.AddAuthorization();
return new SignalRServerBuilder(services);
var builder = new SignalRServerBuilder(services);
builder.AddJsonProtocol();
return builder;
}
}
}

View File

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Implements the SignalR Hub Protocol over JSON.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Microsoft.AspNetCore.SignalR</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Common\JsonUtils.cs" Link="Internal\JsonUtils.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.AspNetCore.SignalR.Common\Microsoft.AspNetCore.SignalR.Common.csproj" />
</ItemGroup>
</Project>

View File

@ -1,11 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>
Implements the SignalR Hub Protocol over MsgPack. This package provides internal infrastructure.
To use MsgPack, use the Microsoft.AspNetCore.SignalR.Client.MsgPack (for the Client) or
Microsoft.AspNetCore.SignalR.MsgPack (for the Server) packages.
</Description>
<Description>Implements the SignalR Hub Protocol over MsgPack.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Microsoft.AspNetCore.SignalR</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

View File

@ -14,8 +14,7 @@ namespace Microsoft.Extensions.DependencyInjection
services.AddConnections();
services.AddSingleton<SignalRMarkerService>();
services.AddSingleton<IConfigureOptions<HubOptions>, HubOptionsSetup>();
return services.AddSignalRCore()
.AddJsonProtocol();
return services.AddSignalRCore();
}
public static ISignalRServerBuilder AddSignalR(this IServiceCollection services, Action<HubOptions> options)

View File

@ -5,7 +5,7 @@ using System;
using System.Buffers;
using System.IO;
using System.Text;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
using Microsoft.AspNetCore.SignalR.Internal;
using Xunit;
namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Protocol

View File

@ -5,7 +5,7 @@ using System;
using System.Buffers;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
using Microsoft.AspNetCore.SignalR.Internal;
using Xunit;
namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Protocol