ml123
ml123

Reputation: 1251

Object doesn't support property or method 'hubConnection' when running SignalR

I'm wetting my legs with SignalR, and starting with a simple tutorial.

Problem is, when I run the application, I get the following error message:

Object doesn't support property or method 'hubConnection'

My HTML is as follows:

<script src="/Scripts/jquery-1.8.2.js"></script>
<script src="/Scripts/jquery.signalR-0.5.2.js"></script>
<script src="/signalr/hubs" type="text/javascript"></script>
<script type="text/javascript">

    $(document).ready(function () {

        var test = $.connection.messagesHub;

        test.addNewMessage = function (message) {
            $('#messages').append('<li>' + message + '');
        };

        $('#broadcast').click(function () {
            test.addMessage($('#message').val());
        });

        $.connection.hub.start();

    });
</script>

And the Hub's code is:

[HubName("messagesHub")]
public class MessagesHub : Hub
{
    public void addMessage(string message)
    {            
        Clients.addNewMessage(message);
    }
}

If I try to browse directly to /signalr/hubs, I get the js contents.

What am I missing? I just can't find the problem...

Upvotes: 0

Views: 1888

Answers (1)

max.tsarenko
max.tsarenko

Reputation: 41

According to Announcing the Release of SignalR 0.5.3 hubConnection object is new in v0.5.3 but you are using v0.5.2.

Upvotes: 3

Related Questions