diff --git a/benchmarks/Microsoft.AspNetCore.SignalR.Microbenchmarks/BroadcastBenchmark.cs b/benchmarks/Microsoft.AspNetCore.SignalR.Microbenchmarks/BroadcastBenchmark.cs index 48e55e1ec8..5d5191430e 100644 --- a/benchmarks/Microsoft.AspNetCore.SignalR.Microbenchmarks/BroadcastBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.SignalR.Microbenchmarks/BroadcastBenchmark.cs @@ -14,6 +14,7 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks { public class BroadcastBenchmark { + private const string TestGroupName = "TestGroup"; private DefaultHubLifetimeManager _hubLifetimeManager; private HubContext _hubContext; @@ -47,6 +48,7 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks var hubConnection = new HubConnectionContext(connection, Timeout.InfiniteTimeSpan, NullLoggerFactory.Instance); hubConnection.Protocol = protocol; _hubLifetimeManager.OnConnectedAsync(hubConnection).GetAwaiter().GetResult(); + _hubLifetimeManager.AddGroupAsync(connection.ConnectionId, TestGroupName).GetAwaiter().GetResult(); _ = ConsumeAsync(connection.Application); } @@ -54,6 +56,12 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks _hubContext = new HubContext(_hubLifetimeManager); } + [Benchmark] + public Task SendAsyncGroup() + { + return _hubContext.Clients.Group(TestGroupName).SendAsync("Method"); + } + [Benchmark] public Task SendAsyncAll() {