I am trying to use signalR for the first time however when my hub 'simpleEvent' is always undefined
$(document).ready(function () {
var simple = $.connection.simpleEvent;
....
If I go to localhost/mywebapp/signalR/hubs I get the following error message: "unable to download hubs from localhost. Unable to open this Internet site. The requested site is either unavailable or cannot be found.". However if I try again then hubs in downloaded and it looks like it has the correct hub information, such as
// Create hub signalR instance
$.extend(signalR, {
simpleEvent: {
_: {
hubName: 'MyCorp.Siep.App.Web.UI.SimpleEventHub',
ignoreMembers: ['init', 'timerExpired', 'namespace', 'ignoreMembers', 'callbacks'],
connection: function () { return signalR.hub; }
},
init: function (callback) {
return serverCall(this, "Init", $.makeArray(arguments));
},
timerExpired: function (state, callback) {
return serverCall(this, "TimerExpired", $.makeArray(arguments));
}
}
});
signalR.hub = signalR("/App.Web.UI/signalr")
.starting(function () {
updateClientMembers(signalR);
})
.sending(function () {
var localHubs = [];
$.each(hubs, function (key) {
var methods = [];
$.each(this, function (key) {
if (key === "obj") {
return true;
}
methods.push(key);
});
localHubs.push({ name: key, methods: methods });
});
this.data = window.JSON.stringify(localHubs);
})
.received(function (result) {
var callbackId, cb;
if (result) {
if (!result.Id) {
executeCallback(result.Hub, result.Method, result.Args, result.State);
} else {
callbackId = result.Id.toString();
cb = callbacks[callbackId];
if (cb) {
callbacks[callbackId] = null;
delete callbacks[callbackId];
cb.callback.call(cb.scope, result);
}
}
}
});
I have tried the SignalR samples and they work fine, I have read lots of other forum posts regarding this error and most of them appear to be because is incorrect, I am assuming that if I can download the hubs then this is not the issue. What else could be causing this problem?
I am trying to use signalR within: - A Web Appplication - Running within visual studio 2010 deployment server and iis 7 - Intenert Explorer 8 - Windows 2008 server
Any help would be greatly appreciated.