I'm working on developing an ASP.Net core 6 application with SignalR, where an android application connects to this service.
I'm performing connection and disconnection tests and when performing the connection loss test in the app, where, I'm disabling the android connection on server side the signalr disconnect runs after 10 minutes.
How can I reduce this time?
In SignalR settings I'm using all the default timeouts
I think your issue or requirement is get some guidance about how to set the default disconnection time on the sever side, so this official document may help you.
KeepAliveInterval is 15s by default and it indicates how long after the ping message should be sent from server to the client to keep the connection open.
Related
my application (Node.js) is using moleculer for microservices and redis as transporter. However, I find that the application will have this log Redis-pub client is disconnected every 10 minutes, then reconnect with the log Redis-pub client is connected after a few seconds. This is a problem because if a client send a moleculer action during this time, it will fail.
Any idea what is causing this? Let me know if more information is needed.
Azure Cache for Redis currently has a 10-minute idle timeout for connections, so the idle timeout setting in your client application should be less than 10 minutes. Most common client libraries have a configuration setting that allows client libraries to send Redis PING commands to a Redis server automatically and periodically. However, when using client libraries without this type of setting, customer applications themselves are responsible for keeping the connection alive.
More info: https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-best-practices-connection#idle-timeout
All,
I am using SignalR (.net 6) and have couple of questions about SignalR Connections (specifically SignalR connections that use web sockets):
Q #1)
If the SignalR client crashes, will SignalR server dispose the underlying connection automatically for me (and the OnDisconnectedAsync() event will be fired)?
The idea is to dispose client resources (on the server, resource ex: NHibernate session) that are tied to each connection.
My Tests Indicate (on local machine, both server and client):
I tried to simulate this scenario where I had a running client which then I shut down with Task manager and the minute Windows released resources for the process, the SignalR server somehow detected that connection was lost and released the connection and OnDisconnectedAsync() was called. I am not sure if my test was sufficient for this use case (client crash). I am curious of how did the server know, was it the fact the maybe the finalizer for client connection ran?
Q #2) If the current connection between client and server is broken or interrupted and SignalR needs to reconnect, and it successfully reconnects, does it use the same connection (with the same connection ID/same web socket) or does it attempt create new connection (tied to a new web socket)?
https://learn.microsoft.com/en-us/aspnet/core/signalr/configuration?view=aspnetcore-6.0&tabs=dotnet
The server considers the client disconnected if it hasn't received a message (including keep-alive) in this interval. It could take longer than this timeout interval for the client to be marked disconnected due to how this is implemented. The recommended value is double the KeepAliveInterval value.
It assigns a new connection id. Consider using other data to track which user is it, eg. Checking in the on connect and on disconnect methods.
https://learn.microsoft.com/en-us/aspnet/core/signalr/groups?view=aspnetcore-6.0
I am using Asp.Net Core 3.1 and Angular8 with Azure SignalR. It connect with azure signalr successfully. But some times it show this message.
This happens when your SignalR hub timeouts some operation and it drops the connection. This is not handled with the "withAutomaticReconnect" since this only reconnects in scenarios like, internet network switch and not hub/client errors.
What you can do is:
Handle by you own when the the disconnected happens by an error.
Try set more time for the ClientTimeoutInterval and the KeepAliveInterval.
Worklight 6.1.0.1 If I have a worklight server session timeout set to 1 hour, and I don't have a heartbeat interval set. The application starts, and establishes a connection with the WL server.
The WL server is shutdown, and not restarted. If the application does not invoke any back requests to the WL server (ex: connect, adapter, etc) while the server is stopped will the loss of connection be detected, or would I have had to set a heartbeat interval to cause the loss of connection to be detected?
If you did not write applicative code to handle off line scenarios, none is going to do that for you.
Consult with the Working Offline training module.
If you want to detect the loss of server connection please use the following
Events that are fired only on change of connectivity state. Success <--> Failure
WL.Events.WORKLIGHT_IS_CONNECTED and WORKLIGHT_IS_DISCONNECTED. For more info see this link
use onConnectionFailure in initOptions to figure out server connection failure.
See this SO answer for more info.
We have a quite strange situation on my sight. Under load our WL 10.3.2 server failed to response. We are using RestEasy with HttpClient version 3.1 to coordinate with web service deployed as WAR.
What we have is a calculation process that run on 4 containers based on 4 physical machines and each of them send request to WL during calculation.
Each run we see a messages from HttpClient like this:
[THREAD1] INFO I/O exception (org.apache.commons.httpclient.NoHttpResponseException) caught when processing request: The server OUR_SERVER_NAME failed to respond
[THREAD1] INFO Retrying request
The HttpClient make several requests until get necessary data.
I want to understand why WL can refuse connections. I read about WL thread pool that process http request and found out that WL allocate separate thread to process web request and the numbers of threads is not bounded in default configuration. Also our server is configured Maximum Open Sockets: -1 which means that the number of open sockets is unlimited.
From this thread I'd want to understand where the issue is? Is it on WL side or it's a problem of our business logic? Can you guys help to deeper investigate the situation.
What should I check more in order to understand that our WL server is configured to work with as much requests as we want?