Click here to Skip to main content
15,392,078 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have been working with SignalR for real time communication in my application for a quite long time but for past few days, I have been facing a strange issue,i.e. After working fine for sometime, signalR seems to be stuck in a way that its showing connected, getting new connection ID on every attempt but not invoking the messages, either used from a JS client or from a Windows/Web Client.

Any Idea/help will be really appreciated?

What I have tried:

Tried google, MSDN, SO and ASP.NET Articles related to SignalR.
Aless Alessio 16-Aug-16 6:27am
Could you paste your code? otherwise i have no clue of what's going on.
VICK 16-Aug-16 6:33am
var chat = $.connection.myHUB;

$.connection.hub.start().done(function () {

var groups = [];
chat.server.subscribe('@User.Identity.Name', groups);
//After this line it shows no response.

Aless Alessio 16-Aug-16 7:19am
What about your Hub (Server code)? And the startup configuration?
If you can debug your server method "subscribe", would you be able to put a breakpoint in it and check if the server method is actually called after "chat.server.subscribe('@User.Identity.Name', groups);" ?
VICK 16-Aug-16 8:01am
It works fine when the SignalR server is started after an IIS Reset(using iisreset command via cmd), and it continue to work fine for quite sometime, But suddenly it stops communicating with the server and didnt hit the breakpoint either.
VICK 16-Aug-16 8:03am
I have been able to reproduce the scenario by doing as below.

1-Build the application(having SignalR Server i.e. HUB)
2-Start the application, It works fine.
3- Stop or Restart the IIS.
4- SignalR client will seems to be reconnected and getting new connection id every time after the step 3.
5-But didnt reach the SignalR Server.
Aless Alessio 16-Aug-16 12:46pm
ok, so it in an issue client side. you should be able to reconnect your client after disconnection with this :

$.connection.hub.disconnected(function() {
setTimeout(function() {
}, 5000); // Restart connection after 5 seconds.
VICK 18-Aug-16 3:39am
But as i said before that it stops communicating with the server only... on the client side it seems to be working fine by getting a new connection id on every restart and showing state as connected.
Aless Alessio 18-Aug-16 5:20am
would you please post a little more code (client and server), or upload the hub/configuration somewhere. otherwise, it is very difficult for me to help
Aless Alessio 18-Aug-16 4:32am
so, if you put a break point in the code i sent you,
after it disconnects is it connecting again after 5 seconds?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900