Note that there are some explanatory texts on larger screens.

plurals
  1. POSignalR - connection.hubName is undefined
    text
    copied!<p>I have the following SignalR hub class (only the top is shown):</p> <pre><code>[HubName("DataServiceHub")] public class DataServiceHub : Hub, IDataServiceHub, IDisconnect, IConnected { . . </code></pre> <p>I'm then self hosting the hub in a Console App using the following code in Main function:</p> <pre><code>string hubsUrl = appSettingsReader.GetValue("hubsUrl", typeof(string)).ToString(); var hubsServer = new Server(hubsUrl); hubsServer.Configuration.DisconnectTimeout = TimeSpan.Zero; hubsServer.MapHubs(); hubsServer.Start(); </code></pre> <p>The values of hubsUrl is "http://localhost:4322/"</p> <p>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:</p> <pre><code>signalR.dataServiceHub = { _: { hubName: 'dataServiceHub', </code></pre> <p>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/"</p> <p>In my Razor page I definately include the SignalR js:</p> <pre><code>&lt;script src="/Website/Scripts/kendo/2012.2.710/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/Website/Scripts/jquery.signalR-0.5.3.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="http://localhost:4322/signalr/hubs" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>Note that we're using Kendo so the jquery js include is via that.</p> <p>Then in the $(document).ready(function () { I have the following:</p> <pre><code>jQuery.support.cors = true; var connection = $.hubConnection('http://localhost:4322'); var hub = connection.dataServiceHub; </code></pre> <p>But 'hub' is always 'undefined'.</p> <p>What am I missing here?</p> <p>If this is cross domain problem - how do I resolve it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload