Skip to content

Commit 6547edb

Browse files
Merge pull request #1736 from aspnet/release/2.1
Add new SignalR scenarios (#1730)
2 parents dcd773d + b7e2678 commit 6547edb

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

benchmarks/BenchmarkServer/Hubs/EchoHub.cs

+14-3
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,34 @@ namespace BenchmarkServer.Hubs
1010
{
1111
public class EchoHub : Hub
1212
{
13-
public async Task Echo(int duration)
13+
public async Task Broadcast(int duration)
1414
{
15+
var sent = 0;
1516
try
1617
{
1718
var t = new CancellationTokenSource();
1819
t.CancelAfter(TimeSpan.FromSeconds(duration));
1920
while (!t.IsCancellationRequested && !Context.ConnectionAborted.IsCancellationRequested)
2021
{
21-
await Clients.All.SendAsync("echo", DateTime.UtcNow);
22+
await Clients.All.SendAsync("send", DateTime.UtcNow);
23+
sent++;
2224
}
2325
}
2426
catch (Exception e)
2527
{
2628
Console.WriteLine(e);
2729
}
30+
Console.WriteLine("Broadcast exited: Sent {0} messages", sent);
31+
}
2832

29-
Console.WriteLine("Echo exited");
33+
public Task Echo(DateTime time)
34+
{
35+
return Clients.Client(Context.ConnectionId).SendAsync("send", time);
36+
}
37+
38+
public Task EchoAll(DateTime time)
39+
{
40+
return Clients.All.SendAsync("send", time);
3041
}
3142
}
3243
}

benchmarks/BenchmarkServer/signalr.json

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@
88
},
99
"Connections": 10,
1010
"Duration": 20,
11-
"Warmup": 2
11+
"Warmup": 2,
12+
"Path": "/echo"
1213
},
1314
"SignalRBroadcast": {
14-
"Path": "/echo"
15+
"ClientProperties": { "Scenario": "broadcast" }
16+
},
17+
"SignalREcho": {
18+
"ClientProperties": { "Scenario": "echo" }
19+
},
20+
"SignalREchoAll": {
21+
"ClientProperties": { "Scenario": "echoAll" }
1522
}
1623
}

0 commit comments

Comments
 (0)