SignalR - connection.hubName is undefined

Related searches

I have the following SignalR hub class (only the top is shown):

[HubName("DataServiceHub")]
public class DataServiceHub : Hub, IDataServiceHub, IDisconnect, IConnected
{
.
.      

I'm then self hosting the hub in a Console App using the following code in Main function:

string hubsUrl = appSettingsReader.GetValue("hubsUrl", typeof(string)).ToString();
var hubsServer = new Server(hubsUrl);
hubsServer.Configuration.DisconnectTimeout = TimeSpan.Zero;
hubsServer.MapHubs();
hubsServer.Start();

The values of hubsUrl is "http://localhost:4322/"

Once I've run up the Console App If I browse in Chrome "http://localhost:4322/signalr/hubs" I can see the SignalR javascript and my hub at the bottom:

signalR.dataServiceHub = {
    _: {
        hubName: 'dataServiceHub',

I'm trying to connect to this hub from an MVC3 app running on a HTTPS/SSL setup (i.e. the site url prefix is "https://localhost/"

In my Razor page I definately include the SignalR js:

<script src="/Website/Scripts/kendo/2012.2.710/jquery.min.js" type="text/javascript"></script>
<script src="/Website/Scripts/jquery.signalR-0.5.3.min.js" type="text/javascript"></script>
<script src="http://localhost:4322/signalr/hubs" type="text/javascript"></script>

Note that we're using Kendo so the jquery js include is via that.

Then in the $(document).ready(function () { I have the following:

jQuery.support.cors = true;
var connection = $.hubConnection('http://localhost:4322');
var hub = connection.dataServiceHub;

But 'hub' is always 'undefined'.

What am I missing here?

If this is cross domain problem - how do I resolve it?


Hubs have 2 programming models and you're mixing them:

  1. http://www.asp.net/signalr/overview/hubs-api/hubs-api-guide-javascript-client
  2. http://www.asp.net/signalr/overview/guide-to-the-api/hubs-api-guide-javascript-client

If you scroll to the bottom of those pages, there's an example that shows you what you need to do to use cross domain in each of the models.

$.connection.(hubname) undefined, "var chat = $ chat. connection.chatHub," the variable i is always "undefined. Jquery libraries and singnalR load successfully. the path "~ / signalr� Re: $.connection.(hubname) undefined Jun 08, 2013 12:12 AM | riteshtandon23 | LINK I was also facing the same problem, The problem was that i was using the dlls of old SignalR version, Then i updated my SignalR files from NuGet and the problem was solved.


make sure that you are referencing jquery 1.6.4

$.hubConnection is undefined, $.connection is undefined signalr cannot read property 'client' of undefined signalr signalr (hubname) undefined, chatHub," the variable i is always " undefined. We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand


Check in your global.asax file, if the line routes.Clear(); is present there, please remove that line because it will clear signal routes.

ASP.NET SignalR Hubs API Guide, For an introduction to SignalR, Hubs, and Persistent Connections, see If you decorate your Hub class with a HubName attribute, use the� $.connection.hubname is undefined. Member 14200962 6-Apr-19 0:24. Member 14200962: if yes, it is TOO bad, I would understand SignalR server side be ASP & IIS,


If you using https don't specify url neither through argument nor via 'url'-property in case when your hub working on the same url. Your hub, otherwise, will be undefined.

UPD

I screwed up guys. I was so hurry to post about specific behavior I 've just detected so I had no check out any possible version more.

However there was a bug in application that provides wrong url to hub with another port than was needed. therefore switching off property setting url for hub proxy has made my client workly.

watch for links your application provides...

.NET SignalR Error: Cannot read property 'client' of undefined, SignalR { [HubName("dashboardHub")] public class DashboardHub : Hub { public void sendMessage(string message) { Clients.All.receiveMessage(notes); } � "TypeError: <hubType> is undefined" error This error will result if the call to MapSignalR is not made properly. See How to register SignalR Middleware and configure SignalR options for more information.


SignalR Can not read property 'MyHub' of undefined, AspNet.SignalR;usingMicrosoft.AspNet.SignalR.Hubs;namespaceZaniADV{[ HubName("MyHub")] public class MyHub : Hub { public static void�