13 implementations of IHubProtocol
Microsoft.AspNetCore.Components.Server (1)
BlazorPack\BlazorPackHubProtocol.cs (1)
16internal sealed class BlazorPackHubProtocol : IHubProtocol
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (2)
HubProtocolVersionTests.cs (1)
197public class SingleVersionHubProtocol : IHubProtocol
VersionJsonHubProtocol.cs (1)
14public class VersionedJsonHubProtocol : IHubProtocol
Microsoft.AspNetCore.SignalR.Client.Tests (1)
HubConnectionTests.cs (1)
964private class MockHubProtocol : IHubProtocol
Microsoft.AspNetCore.SignalR.Microbenchmarks (3)
DefaultHubDispatcherBenchmark.cs (1)
55public class FakeHubProtocol : IHubProtocol
RedisHubLifetimeManagerBenchmark.cs (1)
169private sealed class WrappedHubProtocol : IHubProtocol
RedisProtocolBenchmark.cs (1)
122private sealed class DummyProtocol : IHubProtocol
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
Protocol\JsonHubProtocol.cs (1)
24public sealed class JsonHubProtocol : IHubProtocol
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (1)
Protocol\MessagePackHubProtocol.cs (1)
20public class MessagePackHubProtocol : IHubProtocol
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
Protocol\NewtonsoftJsonHubProtocol.cs (1)
25public class NewtonsoftJsonHubProtocol : IHubProtocol
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (1)
DefaultHubMessageSerializerTests.cs (1)
137internal class TestHubProtocol : IHubProtocol
Microsoft.AspNetCore.SignalR.Tests (1)
AddSignalRTests.cs (1)
328internal class CustomHubProtocol : IHubProtocol
Microsoft.AspNetCore.SignalR.Tests.Utils (1)
DummyHubProtocol.cs (1)
10public class DummyHubProtocol : IHubProtocol
215 references to IHubProtocol
Microsoft.AspNetCore.Components.Server (1)
DependencyInjection\ComponentServiceCollectionExtensions.cs (1)
58services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, BlazorPackHubProtocol>());
Microsoft.AspNetCore.Components.Server.Tests (2)
BlazorPack\BlazorPackHubProtocolTest.cs (1)
11protected override IHubProtocol HubProtocol { get; } = new BlazorPackHubProtocol();
src\SignalR\common\SignalR.Common\test\Internal\Protocol\MessagePackHubProtocolTestBase.cs (1)
33protected abstract IHubProtocol HubProtocol { get; }
Microsoft.AspNetCore.SignalR.Client (1)
HubConnectionBuilderHttpExtensions.cs (1)
180public HubProtocolDerivedHttpOptionsConfigurer(IHubProtocol hubProtocol)
Microsoft.AspNetCore.SignalR.Client.Core (11)
HubConnection.cs (5)
79private readonly IHubProtocol _protocol; 197/// <param name="protocol">The <see cref="IHubProtocol" /> used by the connection.</param> 208public HubConnection(IConnectionFactory connectionFactory, IHubProtocol protocol, EndPoint endPoint, IServiceProvider serviceProvider, ILoggerFactory loggerFactory, IRetryPolicy reconnectPolicy) 218/// <param name="protocol">The <see cref="IHubProtocol" /> used by the connection.</param> 226IHubProtocol protocol,
Internal\SerializedHubMessage.cs (3)
45/// <param name="message">The hub message for the cache. This will be serialized with an <see cref="IHubProtocol"/> in <see cref="GetSerializedMessage"/> to get the message's serialized representation.</param> 52/// Gets the serialized representation of the <see cref="HubMessage"/> using the specified <see cref="IHubProtocol"/>. 56public ReadOnlyMemory<byte> GetSerializedMessage(IHubProtocol protocol)
src\SignalR\common\Shared\MessageBuffer.cs (3)
27private readonly IHubProtocol _protocol; 63public MessageBuffer(ConnectionContext connection, IHubProtocol protocol, long bufferLimit, ILogger logger) 68public MessageBuffer(ConnectionContext connection, IHubProtocol protocol, long bufferLimit, ILogger logger, TimeProvider timeProvider)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (62)
HubConnectionTests.cs (49)
38IHubProtocol protocol = null, 92var protocol = HubProtocols[protocolName]; 131var protocol = HubProtocols["json"]; 161var protocol = HubProtocols["json"]; 191var protocol = HubProtocols[protocolName]; 220var protocol = HubProtocols[protocolName]; 249var protocol = HubProtocols[protocolName]; 281var protocol = HubProtocols[protocolName]; 316var protocol = HubProtocols[protocolName]; 378var protocol = HubProtocols[protocolName]; 408var protocol = HubProtocols[protocolName]; 448var protocol = HubProtocols[protocolName]; 483var protocol = HubProtocols[protocolName]; 529var protocol = HubProtocols[protocolName]; 564var protocol = HubProtocols[protocolName]; 601var protocol = HubProtocols[protocolName]; 649var protocol = HubProtocols[protocolName]; 685var protocol = HubProtocols[protocolName]; 719var protocol = HubProtocols[protocolName]; 761var protocol = HubProtocols[protocolName]; 791var protocol = HubProtocols[protocolName]; 828var protocol = HubProtocols[protocolName]; 875var protocol = HubProtocols[protocolName]; 928var protocol = HubProtocols[protocolName]; 969var protocol = HubProtocols[protocolName]; 1010var protocol = HubProtocols[protocolName]; 1045var protocol = HubProtocols[protocolName]; 1073var hubProtocol = HubProtocols[hubProtocolName]; 1100var hubProtocol = HubProtocols[hubProtocolName]; 1127var hubProtocol = HubProtocols[hubProtocolName]; 1154var hubProtocol = HubProtocols[hubProtocolName]; 1181var hubProtocol = HubProtocols[hubProtocolName]; 1209var hubProtocol = HubProtocols[hubProtocolName]; 1237var hubProtocol = HubProtocols[hubProtocolName]; 1265var hubProtocol = HubProtocols[hubProtocolName]; 1292var hubProtocol = HubProtocols[hubProtocolName]; 1319var hubProtocol = HubProtocols[hubProtocolName]; 1355var protocol = HubProtocols[protocolName]; 1409var protocol = HubProtocols[protocolName]; 1454var hubProtocol = HubProtocols.First().Value; 2553var protocol = HubProtocols["json"]; 2612var protocol = HubProtocols["json"]; 2682var protocol = HubProtocols["json"]; 2754var protocol = HubProtocols["json"]; 2806var protocol = HubProtocols["json"]; 2856var protocol = HubProtocols["json"]; 2878connectionBuilder.Services.AddSingleton<IHubProtocol>(new HubProtocolVersionTests.SingleVersionHubProtocol(HubProtocols["json"], 1)); 3035public static Dictionary<string, IHubProtocol> HubProtocols => 3036new Dictionary<string, IHubProtocol>
HubConnectionTests.Tracing.cs (6)
32var protocol = HubProtocols[protocolName]; 226var protocol = HubProtocols[protocolName]; 371var protocol = HubProtocols[protocolName]; 474var protocol = HubProtocols[protocolName]; 570var protocol = HubProtocols[protocolName]; 660var protocol = HubProtocols[protocolName];
HubProtocolVersionTests.cs (5)
76connectionBuilder.Services.AddSingleton<IHubProtocol>(new VersionedJsonHubProtocol(1000)); 120connectionBuilder.Services.AddSingleton<IHubProtocol>(new VersionedJsonHubProtocol(1000)); 175connectionBuilder.Services.AddSingleton<IHubProtocol>(new SingleVersionHubProtocol(new VersionedJsonHubProtocol(int.MaxValue), int.MaxValue)); 199private readonly IHubProtocol _protocol; 202public SingleVersionHubProtocol(IHubProtocol inner, int version)
VersionStartup.cs (2)
23services.RemoveAll<IHubProtocol>(); 24services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol>(new VersionedJsonHubProtocol(1000)));
Microsoft.AspNetCore.SignalR.Client.Tests (12)
HubConnectionBuilderExtensionsTests.cs (4)
108var resolvedHubProtocol = serviceProvider.GetService<IHubProtocol>(); 121var resolvedHubProtocol = serviceProvider.GetService<IHubProtocol>();
HubConnectionBuilderTests.cs (3)
41var actualProtocol = Assert.IsType<NewtonsoftJsonHubProtocol>(serviceProvider.GetService<IHubProtocol>()); 56var actualProtocol = Assert.IsType<NewtonsoftJsonHubProtocol>(serviceProvider.GetService<IHubProtocol>()); 78Assert.IsType<MessagePackHubProtocol>(serviceProvider.GetService<IHubProtocol>());
HubConnectionTests.cs (2)
153var hubConnection = CreateHubConnection(connection, protocol: Mock.Of<IHubProtocol>(), LoggerFactory); 844var mockConnection = new Mock<HubConnection>(new Mock<IConnectionFactory>().Object, new Mock<IHubProtocol>().Object, new Mock<EndPoint>().Object,
HubConnectionTests.Helpers.cs (1)
17IHubProtocol protocol = null,
MockHubConnection.cs (2)
18IHubProtocol protocol = new Mock<IHubProtocol>().Object;
Microsoft.AspNetCore.SignalR.Common (7)
IInvocationBinder.cs (1)
11/// Class used by <see cref="IHubProtocol"/>s to get the <see cref="Type"/>(s) expected by the hub message being deserialized.
Protocol\HandshakeProtocol.cs (1)
49public static ReadOnlySpan<byte> GetSuccessfulHandshake(IHubProtocol protocol) => _successHandshakeData.Span;
Protocol\HubProtocolExtensions.cs (2)
9/// Extension methods for <see cref="IHubProtocol"/>. 19public static byte[] GetMessageBytes(this IHubProtocol hubProtocol, HubMessage message)
Protocol\InvocationBindingFailureMessage.cs (1)
10/// message that is sent on the wire, it is returned by <see cref="IHubProtocol.TryParseMessage"/>
Protocol\RawResult.cs (1)
14/// Type returned to <see cref="IHubProtocol"/> implementations to let them know the object being deserialized should be
Protocol\StreamBindingFailureMessage.cs (1)
13/// message that is sent on the wire, it is returned by <see cref="IHubProtocol.TryParseMessage"/>
Microsoft.AspNetCore.SignalR.Common.Tests (15)
Internal\Protocol\JsonHubProtocolTests.cs (4)
24protected override IHubProtocol JsonHubProtocol => new JsonHubProtocol(); 26protected override IHubProtocol GetProtocolWithOptions(bool useCamelCase, bool ignoreNullValues) 69var protocol = GetProtocolWithOptions(testData.UseCamelCase, testData.IgnoreNullValues); 91var protocol = GetProtocolWithOptions(testData.UseCamelCase, testData.IgnoreNullValues);
Internal\Protocol\JsonHubProtocolTestsBase.cs (5)
16protected abstract IHubProtocol JsonHubProtocol { get; } 18protected abstract IHubProtocol GetProtocolWithOptions(bool useCamelCase, bool ignoreNullValues); 124var protocol = GetProtocolWithOptions(testData.UseCamelCase, testData.IgnoreNullValues); 146var protocol = GetProtocolWithOptions(testData.UseCamelCase, testData.IgnoreNullValues); 222var protocol = GetProtocolWithOptions(testData.UseCamelCase, testData.IgnoreNullValues);
Internal\Protocol\MessagePackHubProtocolTestBase.cs (1)
33protected abstract IHubProtocol HubProtocol { get; }
Internal\Protocol\MessagePackHubProtocolTests.cs (1)
14protected override IHubProtocol HubProtocol => new MessagePackHubProtocol();
Internal\Protocol\NewtonsoftJsonHubProtocolTests.cs (4)
23protected override IHubProtocol JsonHubProtocol => new NewtonsoftJsonHubProtocol(); 25protected override IHubProtocol GetProtocolWithOptions(bool useCamelCase, bool ignoreNullValues) 64var protocol = GetProtocolWithOptions(testData.UseCamelCase, testData.IgnoreNullValues); 90var protocol = GetProtocolWithOptions(testData.UseCamelCase, testData.IgnoreNullValues);
Microsoft.AspNetCore.SignalR.Core (24)
HubConnectionContext.cs (1)
169public virtual IHubProtocol Protocol { get; set; } = default!;
HubConnectionHandler.cs (1)
266var protocol = connection.Protocol;
HubLifetimeManager.cs (1)
164/// Tells <see cref="IHubProtocol"/> implementations what the expected type from a connection result is.
HubOptionsSetup.cs (3)
30/// <param name="protocols">The list of <see cref="IHubProtocol"/>s that are from Dependency Injection.</param> 31public HubOptionsSetup(IEnumerable<IHubProtocol> protocols) 33foreach (var hubProtocol in protocols)
IHubProtocolResolver.cs (4)
9/// A resolver abstraction for working with <see cref="IHubProtocol"/> instances. 16IReadOnlyList<IHubProtocol> AllProtocols { get; } 23/// <returns>A matching <see cref="IHubProtocol"/> or <c>null</c> if no matching protocol was found.</returns> 24IHubProtocol? GetProtocol(string protocolName, IReadOnlyList<string>? supportedProtocols);
Internal\DefaultHubProtocolResolver.cs (8)
14private readonly List<IHubProtocol> _hubProtocols; 15private readonly Dictionary<string, IHubProtocol> _availableProtocols; 17public IReadOnlyList<IHubProtocol> AllProtocols => _hubProtocols; 19public DefaultHubProtocolResolver(IEnumerable<IHubProtocol> availableProtocols, ILogger<DefaultHubProtocolResolver> logger) 22_availableProtocols = new Dictionary<string, IHubProtocol>(StringComparer.OrdinalIgnoreCase); 24foreach (var protocol in availableProtocols) 32public IHubProtocol? GetProtocol(string protocolName, IReadOnlyList<string>? supportedProtocols) 36if (_availableProtocols.TryGetValue(protocolName, out var protocol) && (supportedProtocols == null || supportedProtocols.Contains(protocolName, StringComparer.OrdinalIgnoreCase)))
SerializedHubMessage.cs (3)
40/// <param name="message">The hub message for the cache. This will be serialized with an <see cref="IHubProtocol"/> in <see cref="GetSerializedMessage"/> to get the message's serialized representation.</param> 47/// Gets the serialized representation of the <see cref="HubMessage"/> using the specified <see cref="IHubProtocol"/>. 51public ReadOnlyMemory<byte> GetSerializedMessage(IHubProtocol protocol)
src\SignalR\common\Shared\MessageBuffer.cs (3)
27private readonly IHubProtocol _protocol; 63public MessageBuffer(ConnectionContext connection, IHubProtocol protocol, long bufferLimit, ILogger logger) 68public MessageBuffer(ConnectionContext connection, IHubProtocol protocol, long bufferLimit, ILogger logger, TimeProvider timeProvider)
Microsoft.AspNetCore.SignalR.Microbenchmarks (15)
BroadcastBenchmark.cs (1)
30IHubProtocol protocol;
HubConnectionContextBenchmark.cs (4)
83private readonly IHubProtocol _instance; 85public IReadOnlyList<IHubProtocol> AllProtocols { get; } 87public TestHubProtocolResolver(IHubProtocol instance) 93public IHubProtocol GetProtocol(string protocolName, IReadOnlyList<string> supportedProtocols)
HubConnectionReceiveBenchmark.cs (2)
60IHubProtocol hubProtocol; 72hubConnectionBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(IHubProtocol), hubProtocol));
HubProtocolBenchmark.cs (1)
12private IHubProtocol _hubProtocol;
RedisHubLifetimeManagerBenchmark.cs (5)
49async Task ConnectClient(TestClient client, IHubProtocol protocol, string userId, string groupName) 61var protocol = protocols[i % ProtocolCount]; 93private IEnumerable<IHubProtocol> GenerateProtocols(int protocolCount) 172private readonly IHubProtocol _innerProtocol; 180public WrappedHubProtocol(string name, IHubProtocol innerProtocol)
RedisProtocolBenchmark.cs (1)
31var resolver = new DefaultHubProtocolResolver(new List<IHubProtocol> { new DummyProtocol("protocol1"),
ServerSentEventsBenchmark.cs (1)
26IHubProtocol protocol;
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
JsonProtocolDependencyInjectionExtensions.cs (1)
38builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, JsonHubProtocol>());
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (1)
MessagePackProtocolDependencyInjectionExtensions.cs (1)
41builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, MessagePackHubProtocol>());
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
NewtonsoftJsonProtocolDependencyInjectionExtensions.cs (1)
41builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, NewtonsoftJsonHubProtocol>());
Microsoft.AspNetCore.SignalR.Specification.Tests (3)
src\SignalR\common\testassets\Tests.Utils\HubConnectionContextUtils.cs (1)
17public static HubConnectionContext Create(ConnectionContext connection, IHubProtocol protocol = null, string userIdentifier = null)
src\SignalR\common\testassets\Tests.Utils\TestClient.cs (2)
29private readonly IHubProtocol _protocol; 41public TestClient(IHubProtocol protocol = null, IInvocationBinder invocationBinder = null, string userIdentifier = null, long pauseWriterThreshold = 32768)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (8)
Internal\DefaultHubMessageSerializer.cs (4)
11private readonly List<IHubProtocol> _hubProtocols; 16_hubProtocols = new List<IHubProtocol>(supportedProtocols.Count); 19var protocol = hubProtocolResolver.GetProtocol(protocolName, (supportedProtocols as IReadOnlyList<string>) ?? supportedProtocols.ToList()); 30foreach (var protocol in _hubProtocols)
RedisHubLifetimeManager.cs (4)
49/// <param name="hubProtocolResolver">The <see cref="IHubProtocolResolver"/> to get an <see cref="IHubProtocol"/> instance when writing to connections.</param> 62/// <param name="hubProtocolResolver">The <see cref="IHubProtocolResolver"/> to get an <see cref="IHubProtocol"/> instance when writing to connections.</param> 649IHubProtocol? protocol = null; 650foreach (var hubProtocol in _hubProtocolResolver.AllProtocols)
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (26)
DefaultHubMessageSerializerTests.cs (9)
24var resolver = CreateHubProtocolResolver(new List<IHubProtocol> { new MessagePackHubProtocol(), new JsonHubProtocol() }); 44var resolver = CreateHubProtocolResolver(new List<IHubProtocol> { new MessagePackHubProtocol(), new JsonHubProtocol() }); 62private IHubProtocolResolver CreateHubProtocolResolver(List<IHubProtocol> hubProtocols) 71new List<IHubProtocol>() { new MessagePackHubProtocol() }, 83new List<IHubProtocol>() { new MessagePackHubProtocol(), new JsonHubProtocol() }, 100new List<IHubProtocol>() { new MessagePackHubProtocol(), new TestHubProtocol() }, 112new List<IHubProtocol>(), 123public List<IHubProtocol> SupportedHubProtocols { get; } 125public ProtocolTestData(string name, List<IHubProtocol> supportedHubProtocols, int serializedCount, params byte[] encoded)
RedisEndToEnd.cs (7)
44var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); 64var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); 96var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); 128var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); 154var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); 190var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); 215private static HubConnection CreateConnection(string url, HttpTransportType transportType, IHubProtocol protocol, ILoggerFactory loggerFactory, string userName = null)
RedisHubLifetimeManagerTests.cs (2)
38new DefaultHubProtocolResolver(new IHubProtocol[] 108new DefaultHubProtocolResolver(new IHubProtocol[]
RedisProtocolTests.cs (8)
38var protocol = new RedisProtocol(CreateHubMessageSerializer(new List<IHubProtocol>())); 50var protocol = new RedisProtocol(CreateHubMessageSerializer(new List<IHubProtocol>())); 70var protocol = new RedisProtocol(CreateHubMessageSerializer(new List<IHubProtocol>())); 86var protocol = new RedisProtocol(CreateHubMessageSerializer(new List<IHubProtocol>())); 146var protocol = new RedisProtocol(CreateHubMessageSerializer(hubProtocols.Cast<IHubProtocol>().ToList())); 177var protocol = new RedisProtocol(CreateHubMessageSerializer(new List<IHubProtocol>() { new DummyHubProtocol("p1"), new DummyHubProtocol("p2") })); 192var hubMessageSerializer = CreateHubMessageSerializer(new List<IHubProtocol>() { new DummyHubProtocol("p1"), new DummyHubProtocol("p2") }); 295private DefaultHubMessageSerializer CreateHubMessageSerializer(List<IHubProtocol> protocols)
Microsoft.AspNetCore.SignalR.Tests (16)
AddSignalRTests.cs (5)
35var hubOptions = new HubOptionsSetup(new List<IHubProtocol>()); 178serviceCollection.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, CustomHubProtocol>()); 179serviceCollection.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, MessagePackHubProtocol>()); 222public IReadOnlyList<IHubProtocol> AllProtocols => throw new System.NotImplementedException(); 224public IHubProtocol GetProtocol(string protocolName, IReadOnlyList<string> supportedProtocols)
HubConnectionHandlerTests.ClientResult.cs (1)
344IHubProtocol hubProtocol;
HubConnectionHandlerTests.cs (6)
254var hubProtocolMock = new Mock<IHubProtocol>(); 278var hubProtocolMock = new Mock<IHubProtocol>(); 638var hubProtocolMock = new Mock<IHubProtocol>(); 2007var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); 3893var testProtocol = new Mock<IHubProtocol>(); 3899LoggerFactory, (services) => services.AddSingleton<IHubProtocol>(testProtocol.Object));
Internal\DefaultHubProtocolResolverTests.cs (4)
21var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); 33var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); 46var protocol = HubProtocolHelpers.GetHubProtocol(protocolName); 82var resolvedProtocol = resolver.GetProtocol(jsonProtocol2.Name, null);
Microsoft.AspNetCore.SignalR.Tests.Utils (9)
HubConnectionContextUtils.cs (1)
17public static HubConnectionContext Create(ConnectionContext connection, IHubProtocol protocol = null, string userIdentifier = null)
HubProtocolHelpers.cs (6)
10private static readonly IHubProtocol NewtonsoftJsonHubProtocol = new NewtonsoftJsonHubProtocol(); 12private static readonly IHubProtocol MessagePackHubProtocol = new MessagePackHubProtocol(); 20public static readonly IList<IHubProtocol> AllProtocols = new List<IHubProtocol>() 26public static IHubProtocol GetHubProtocol(string name) 28var protocol = AllProtocols.SingleOrDefault(p => p.Name == name);
TestClient.cs (2)
29private readonly IHubProtocol _protocol; 41public TestClient(IHubProtocol protocol = null, IInvocationBinder invocationBinder = null, string userIdentifier = null, long pauseWriterThreshold = 32768)