Reputation: 88
I'm trying to implement a chat module in an ASP.NET MVC 4 application based on an example over here. Since this one's not using the latest SignalR version (0.5.3), I had to tweak the code to make it work.
Problem is, I couldn't even get the hubConnection to work. I'm encountering a JS error that says:
Uncaught TypeError: Object function ( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
} has no method 'hubConnection'
I'm not sure why there's no hubConnection method. I have the latest jQuery and SignalR libraries, and I just followed the SignalR 0.5.3 release notes here. Here's a snippet of the generated code in my View:
<script src="/Scripts/jquery-1.8.2.js"></script>
<script src="/Scripts/jquery.signalR-0.5.3.js"></script>
<script type="text/javascript" src="/signalr/hubs"></script>
<script type="text/javascript">
$(function () {
var connection = $.hubConnection();
var chatHubClient = connection.createProxy("chatHub");
connection.start(function () {
chatHubClient.join('TEST');
});
});
</script>
I hope someone can point me to the right direction. Thanks.
Upvotes: 5
Views: 10772
Reputation: 9189
I presume you followed the walkthrough that came with 0.5.3's announcement already? http://blogs.msdn.com/b/webdev/archive/2012/08/22/announcing-the-release-of-signalr-0-5-3.aspx
make sure you can open both /Scripts/jquery.signalR-0.5.3.js and /signalr/hubs in a browser.
Upvotes: 5