API review Microsoft.AspNetCore.SignalR.Internal (#2022)

This commit is contained in:
James Newton-King 2018-04-15 00:23:26 +12:00 committed by GitHub
parent 4fe41dc6d0
commit 5a77c8be25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 9 additions and 7 deletions

View File

@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
_instance = instance; _instance = instance;
} }
public IHubProtocol GetProtocol(string protocolName, IList<string> supportedProtocols) public IHubProtocol GetProtocol(string protocolName, IReadOnlyList<string> supportedProtocols)
{ {
return _instance; return _instance;
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.SignalR.Protocol namespace Microsoft.AspNetCore.SignalR.Protocol
{ {
public class StreamItemMessage : HubInvocationMessage public class StreamItemMessage : HubInvocationMessage

View File

@ -273,7 +273,7 @@ namespace Microsoft.AspNetCore.SignalR
Task.Factory.StartNew(_abortedCallback, this); Task.Factory.StartNew(_abortedCallback, this);
} }
internal async Task<bool> HandshakeAsync(TimeSpan timeout, IList<string> supportedProtocols, IHubProtocolResolver protocolResolver, internal async Task<bool> HandshakeAsync(TimeSpan timeout, IReadOnlyList<string> supportedProtocols, IHubProtocolResolver protocolResolver,
IUserIdProvider userIdProvider, bool enableDetailedErrors) IUserIdProvider userIdProvider, bool enableDetailedErrors)
{ {
try try

View File

@ -2,6 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Core; using Microsoft.AspNetCore.SignalR.Core;
@ -61,7 +63,8 @@ namespace Microsoft.AspNetCore.SignalR
var connectionContext = new HubConnectionContext(connection, keepAlive, _loggerFactory); var connectionContext = new HubConnectionContext(connection, keepAlive, _loggerFactory);
if (!await connectionContext.HandshakeAsync(handshakeTimeout, supportedProtocols, _protocolResolver, _userIdProvider, _enableDetailedErrors)) var resolvedSupportedProtocols = (supportedProtocols as IReadOnlyList<string>) ?? supportedProtocols.ToList();
if (!await connectionContext.HandshakeAsync(handshakeTimeout, resolvedSupportedProtocols, _protocolResolver, _userIdProvider, _enableDetailedErrors))
{ {
return; return;
} }

View File

@ -4,11 +4,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.SignalR.Protocol; using Microsoft.AspNetCore.SignalR.Protocol;
namespace Microsoft.AspNetCore.SignalR.Internal namespace Microsoft.AspNetCore.SignalR
{ {
public interface IHubProtocolResolver public interface IHubProtocolResolver
{ {
IReadOnlyList<IHubProtocol> AllProtocols { get; } IReadOnlyList<IHubProtocol> AllProtocols { get; }
IHubProtocol GetProtocol(string protocolName, IList<string> supportedProtocols); IHubProtocol GetProtocol(string protocolName, IReadOnlyList<string> supportedProtocols);
} }
} }

View File

@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal
} }
} }
public IHubProtocol GetProtocol(string protocolName, IList<string> supportedProtocols) public virtual IHubProtocol GetProtocol(string protocolName, IReadOnlyList<string> supportedProtocols)
{ {
protocolName = protocolName ?? throw new ArgumentNullException(nameof(protocolName)); protocolName = protocolName ?? throw new ArgumentNullException(nameof(protocolName));