Reputation: 539
I have some very basic SignalR code running on the js client:
var conn = $.connection("@Url.Content("/echo")");
conn.Debug = function (msg) {
console.log(msg);
};
conn.start();
This code executes and works, except I get a 404 Error. The JS is trying to access http://localhost:32344/echo/negotiate and it can't find it. If I hit the url without the "negotiate", the request completes.
I did not touch the Global.asax, and the server code is as basic as it gets, but there are not calls to this code from the client yet:
public class SpatialHub : Hub
{
public void Send(string data)
{
Caller.Debug("sent!");
}
}
Any thoughts would be appreciated. Thanks!
Upvotes: 1
Views: 1928
Reputation: 38764
You're mixing the "High level hub" client side server code with the "low level connection" client side API.
Follow the quick starts here for and end to end example of each:
Upvotes: 4
Reputation: 539
I see where I went wrong. I was looking for a solution to a different problem and mixed up the two. However, I've learned that one must include method calls in hub.start if the method call is happening immediately:
$.connection.hub.start(function () {
myhub.send('test');
});
Upvotes: 0