I'm using Visual Studio 2012 Ultimate RC, SignalR 0.5.1 and Jquery 1.7.2 in an MVC4 application.
I have looked at: MVC4 SignalR "signalr/hubs" 501 Not Implemented Error
But it does not affect my issue (I am using IIS Express to debug).
When I try to utilize SignalR the $.connection variable is undefined. My server side code:
[HubName("tenantHub")]
public class TenantHub : Hub
{
...
void TenantChange(CrudAction action, Tenant tenant)
{
Clients.eventOccurred(action.ToString(), tenant);
}
}
Client side:
$(function() { var test = $.connection.tenantHub; });
Client side SignalR/hubs
is being referenced and I can see the JS code, it does not throw any errors. But referencing $.connection throws a Uncaught TypeError: Cannot read property 'tenantHub' of undefined
. Also tried to do the default chat example, it gives the same error. Is SignalR unsupported when utilized in VS2012 or am I just being stupid?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…