Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SignalR client cannot connect to SignalR server #59639

Open
zhenlei520 opened this issue Dec 25, 2024 · 3 comments
Open

SignalR client cannot connect to SignalR server #59639

zhenlei520 opened this issue Dec 25, 2024 · 3 comments
Labels
area-signalr Includes: SignalR clients and servers

Comments

@zhenlei520
Copy link

zhenlei520 commented Dec 25, 2024

OS:Ubuntu 22.04
SignalR Server: .net8.0
SignalR.Client 7.0.10
I use SignalR server to push messages to SignalR, but when there are many SignalR clients, it is easy for the SignalR client to be unable to connect to the SignalR server. This situation is easy to occur when the number of client connections exceeds 2000. I suspect it is related to the excessive number of client connections. I wonder if there is any recommended configuration for this?

Due to special circumstances, distribution is not supported for the time being, and only one SignalR server can be used, so I hope it can support more client connections

.AddSignalR(options =>
{
options.EnableDetailedErrors = true;
options.MaximumReceiveMessageSize = 1024 * 1024 * 10;
})

app.MapHub<RelationHub>("/relationhub", options =>
{
// 1024 * 1024 * 10 = 10MB
options.ApplicationMaxBufferSize = 1024 * 1024 * 10;
options.TransportMaxBufferSize = 1024 * 1024 * 10;
});

The server's CPU and memory are both below 20%, and the bandwidth performance is good.

ulimit -n
65535
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-signalr Includes: SignalR clients and servers label Dec 25, 2024
@zhenlei520
Copy link
Author

By adding logs, it was found that an error occurred when the client sent a message to the server. The error message was:

Exception:System.TimeoutException: Server timeout (30000.00ms) elapsed without receiving a message from the server.

   at Microsoft.AspNetCore.SignalR.Client.HubConnection.InvokeCoreAsyncCore(String methodName, Type returnType, Object[] args, CancellationToken cancellationToken)

   at Microsoft.AspNetCore.SignalR.Client.HubConnection.InvokeCoreAsync(String methodName, Type returnType, Object[] args, CancellationToken cancellationToken)

@zhenlei520
Copy link
Author

But I don't know why the client will time out when sending messages to the server. There is no problem with the network.

@profimedica
Copy link

profimedica commented Dec 27, 2024

Have you tried to skip negotiation?
Are you sure the SSL is valid?

app.MapHub("/relationhub", options =>
{
// add your options and the SkipNegotiation.
options.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransportType.WebSockets;
options.WebSockets = webSocketOptions =>
{
webSocketOptions.SkipNegotiation = true;
};
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

No branches or pull requests

2 participants