Undefined hub & tracking down the root cause. #1182

rustd opened this Issue Dec 20, 2012 · 2 comments


None yet
3 participants

rustd commented Dec 20, 2012

If no hubs are available (for whatever reason -- in my case, "signalr/hubs" was 404ing) and I try to access one, SignalR should do something to point me in the right direction.

For instance, I started with the following line:

var hub = $.connection.myHub;

Then, a while later in my code, I try to do something with hub, assuming it was valid:

hub.client.doSomething = function () {};

I get an unhandled exception: "Unable to get property 'client' of undefined or null reference." This tells me that 'myHub' is not defined, but I have no idea why. It would have been a little easier to follow if $.connection had raised something earlier or given me some kind of warning, instead of just returning undefined.

Ultimately what was happening was that "signalr/hubs" was 404ing because I had the order wrong in Global.asax. Moving this line earlier in the file (before the routes get registered) fixed the issue:



davidfowl commented Dec 27, 2012

Not sure where this would go besides the docs (which we already have). @rustd do you have any good suggestions?

+1 for this if at all possible

@davidfowl davidfowl closed this Jun 25, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment