Skip to content

Commit

Permalink
fix: RpcBenchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyakunin committed Dec 7, 2023
1 parent e32ce38 commit 277d684
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
15 changes: 3 additions & 12 deletions src/RpcBenchmark/Client/Clients/ClientFactories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,9 @@ private IServiceCollection CreateBaseServiceCollection()
var connection = new HubConnectionBuilder()
.WithUrl($"{BaseUrl}hubs/testService", options => {
options.Transports = HttpTransportType.WebSockets;
options.WebSocketFactory = async (context, ct) => {
var ws = new ClientWebSocket();
ws.Options.HttpVersion = HttpVersion.Version11;
ws.Options.RemoteCertificateValidationCallback = (_, _, _, _) => true;
try {
await ws.ConnectAsync(context.Uri, ct).ConfigureAwait(false);
return ws;
}
catch {
ws.Dispose();
throw;
}
options.WebSocketConfiguration = ws => {
ws.HttpVersion = HttpVersion.Version11;
ws.RemoteCertificateValidationCallback = (_, _, _, _) => true;
};
})
.Build();
Expand Down
4 changes: 3 additions & 1 deletion src/RpcBenchmark/CommandLine/ServerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public override async Task<int> RunAsync()
// Core services
var services = builder.Services;
services.AddSignalR(hub => {
hub.MaximumParallelInvocationsPerClient = 100_000_000; // Can't be int.MaxValue!
hub.MaximumParallelInvocationsPerClient = 1000; // Can't be too high, otherwise SignalR fails!
hub.DisableImplicitFromServicesParameters = true;
});
var rpc = services.AddRpc();
rpc.AddWebSocketServer();
Expand Down Expand Up @@ -83,6 +84,7 @@ public override async Task<int> RunAsync()
app.MapGrpcService<GrpcTestService>();
app.MapHub<TestHub>("hubs/testService", o => {
o.Transports = HttpTransportType.WebSockets;
o.AllowStatefulReconnects = false;
});
app.MapMagicOnionService();
app.MapStreamJsonRpcService<JsonRpcTestService>("stream-json-rpc");
Expand Down

0 comments on commit 277d684

Please sign in to comment.