File tree 2 files changed +23
-5
lines changed
benchmarks/BenchmarkServer
2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -10,23 +10,34 @@ namespace BenchmarkServer.Hubs
10
10
{
11
11
public class EchoHub : Hub
12
12
{
13
- public async Task Echo ( int duration )
13
+ public async Task Broadcast ( int duration )
14
14
{
15
+ var sent = 0 ;
15
16
try
16
17
{
17
18
var t = new CancellationTokenSource ( ) ;
18
19
t . CancelAfter ( TimeSpan . FromSeconds ( duration ) ) ;
19
20
while ( ! t . IsCancellationRequested && ! Context . ConnectionAborted . IsCancellationRequested )
20
21
{
21
- await Clients . All . SendAsync ( "echo" , DateTime . UtcNow ) ;
22
+ await Clients . All . SendAsync ( "send" , DateTime . UtcNow ) ;
23
+ sent ++ ;
22
24
}
23
25
}
24
26
catch ( Exception e )
25
27
{
26
28
Console . WriteLine ( e ) ;
27
29
}
30
+ Console . WriteLine ( "Broadcast exited: Sent {0} messages" , sent ) ;
31
+ }
28
32
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 ) ;
30
41
}
31
42
}
32
43
}
Original file line number Diff line number Diff line change 8
8
},
9
9
"Connections" : 10 ,
10
10
"Duration" : 20 ,
11
- "Warmup" : 2
11
+ "Warmup" : 2 ,
12
+ "Path" : " /echo"
12
13
},
13
14
"SignalRBroadcast" : {
14
- "Path" : " /echo"
15
+ "ClientProperties" : { "Scenario" : " broadcast" }
16
+ },
17
+ "SignalREcho" : {
18
+ "ClientProperties" : { "Scenario" : " echo" }
19
+ },
20
+ "SignalREchoAll" : {
21
+ "ClientProperties" : { "Scenario" : " echoAll" }
15
22
}
16
23
}
You can’t perform that action at this time.
0 commit comments