Hey everyone, having some trouble with my SignalR Client here. Every time I try to run it, I get this pesky error popping up: 0x800a139e - JavaScript runtime error: SignalR: Error loading hubs. It's telling me to check my hubs reference, so I need to make sure everything is set up correctly.
The error seems to be originating from this line of code: $.connection.hub.start
I have a ServerHub class located in the HUBS folder within my Server application and that part is working just fine.
If anyone has any insights or solutions, please share them with me. Thanks!
<script src="~/Scripts/jquery.signalR-2.2.0.min.js"></script>
<script src="http://localhost:39670/MySignalRServer/signalr/hubs"></script>
var ChatHubProxy = $.hubConnection("http://localhost:39670/MySignalRServer/signalr/hubs");
var chat = ChatHubProxy.createHubProxy('ServerHub');
chat.on("addNewMessageToPage",function (name, message) {
// Add the message to the page.
$('#discussion').append('<li><strong>' + htmlEncode(name)
+ '</strong>: ' + htmlEncode(message) + '</li>');
});
$.connection.hub.start({jsonp:true}).done(function () {
$('#sendmessage').click(function () {
// Call the Send method on the hub.
chat.server.send($('#displayname').val(), $('#message').val());
alert("hiii");
// Clear text box and reset focus for next comment.
$('#message').val('').focus();
});
});