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;
}
public IHubProtocol GetProtocol(string protocolName, IList<string> supportedProtocols)
public IHubProtocol GetProtocol(string protocolName, IReadOnlyList<string> supportedProtocols)
{
return _instance;
}

View File

@ -1,7 +1,6 @@
// 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.
namespace Microsoft.AspNetCore.SignalR.Protocol
{
public class StreamItemMessage : HubInvocationMessage

View File

@ -273,7 +273,7 @@ namespace Microsoft.AspNetCore.SignalR
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)
{
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.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.SignalR.Core;
@ -61,7 +63,8 @@ namespace Microsoft.AspNetCore.SignalR
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;
}

View File

@ -4,11 +4,11 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.SignalR.Protocol;
namespace Microsoft.AspNetCore.SignalR.Internal
namespace Microsoft.AspNetCore.SignalR
{
public interface IHubProtocolResolver
{
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));