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 hub connection taking almost 40 seconds time to connect with server. #4582
Comments
any one faced this issue before? |
Hi, I have not seen this problem before but here is some info that could help. What protocol are you using? It might be that it is taking too long to negotiate between the client and the server about which protocol to use. Try setting it to websockets if possible and check if the problem is still there? What client(s) are you using? JavaScript, .NET, something else...? What version of SignalR? Are you seeing the issue with any particular ones? If you are using JavaScript, is there a particular browser that is having an issue? If you are not using the latest version 2.4.2, try it. Check SignalR trace and logs (https://docs.microsoft.com/en-us/aspnet/signalr/overview/testing-and-debugging/enabling-signalr-tracing). It should show you what is happening and which steps take so long. Check if there are any exceptions inside of the SignalR library. Are you using a proxy? If yes, check the proxy log for Finally, how many servers do you have in production? If more than one, are you using a backplane? Hope this helps. |
I am using SignalR (Microsoft.AspNet.SignalR (Version: 2.4.2)). On localhost it is working fine and response time is very fast, but when I'm deployed project to live server it is taking too much time to make connection. I noticed that on google chrome, and edage it is connecting in 10 seconds average but on Firefox and Internet explorer it is not connecting. All these browsers are in latest version Here is my javascript code:
Here is server side code on startup: I have not added any specific changes for proxy.
I have two servers, one is for development and one is for production. I have tried on both. |
Hi,
Try tuning SignalR on the server: https://docs.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/handling-connection-lifetime-events There is also a section on improving SignalR performance in the documentation https://docs.microsoft.com/en-us/aspnet/signalr/overview/performance/signalr-performance For Firefox and IE issues, checkout StackOverflow:
Looks like you may want to add a timeout to your client connect logic and change the order. Get traces from both the client and the server. Compare client traces between Chrome and Firefox to see the differences. Try running the sample project from the documentation to see if the problem can be preproduced. This could point to something in the infrastructure. |
There is not specific reason for using webSockets, now I am using just $.connection.hub.start() and it is working on all browsers. I have also followed above examples but connection time not improved. I am trying to fix it from 3 weeks but I did not get access to improve connection time. These are the traces on development server (Umbraco Cloud server):
|
Hi,
This sounds like an infrastructure problem. I also have an issue where SignalR works great in QA but not in Production; however, my issue is with using backplane and sharing SignalR load between multiple servers. What about traces on production server? My understanding is that the development server is working fine. Is the trace from the server that is working fine? Get the trace from the problem server and a client and see what the differences are. How many clients do you have at any one time? Check the logs to see if they are constantly connecting and disconnecting. This can cause an issue. In my implementation, I ended up adding my own ping to keep the connection alive. You might also want to "play" with the timeout settings in This is what I have:
Finally, add this to your client to see if there are connection issues.
|
It may be infrastructure problem. Actually sometime it is connecting in 3 seconds only, so I am thinking Is that infrastructure issue? I checked traces of transports.log.txt on dev and live and it is same on both. I also tried GlobalHost.Configurations but connection making time is not reducing. |
Sounds like something with infrastructure to me. You could try Wireshark to see if there is something that takes place when the connection is delayed. |
@arielchawla any results? |
this article help me to figure out the issue and the issue got fixed by using the full url |
On local host it is working fine but when I deployed on live server then its not working properly, it is taking very long time to connect. Please suggest me how can I solve this issue?
The text was updated successfully, but these errors were encountered: