title: Signalr not calling client function
body: <p>I realize this question has been asked <a href="https://stackoverflow.com/questions/18314671/client-function-not-getting-called-signalr">several</a> <a href="https://stackoverflow.com/questions/14072223/signalr-js-client-methods-not-invoked">times</a>, but the solution others posted is not my solution. So, I'm hoping there's another answer to this problem that solves it for me.</p>
  
  <p>When debugging this on this on the server, it finds the appropriate client and calls the "addAlert" method. This Javascript gets initialized fine and the "Alert Ready" message is written to the console.</p>
  
  <p>There are no error messages on either the server nor client code: </p>
  
  <pre><code>$(function () {
  
      // enable logging for debugging
      $.connection.hub.logging = true;
  
      // Declare a proxy to reference the hub. 
      var hub = $.connection.alertHub;
  
      hub.client.addAlert = function (id, title, url, dateTime) {
          console.log(title);
      };
  
      $.connection.hub.start().done(function () {
          console.log("Alert Ready");
      });
  });
  </code></pre>
  
  <blockquote>
    <p>[09:12:51 GMT-0600 (Central America Standard Time)] SignalR: Client
    subscribed to hub 'alerthub'. jquery.signalR-2.0.0.min.js:8 [09:12:51
    GMT-0600 (Central America Standard Time)] SignalR: Negotiating with
    '/signalr/negotiate?connectionData=%5B%7B%22name%22%3A%22alerthub%22%7D%5D&amp;clientProtocol=1.3'.
    jquery.signalR-2.0.0.min.js:8 [09:12:51 GMT-0600 (Central America
    Standard Time)] SignalR: Connecting to websocket endpoint
    'ws://mysite.local/signalr/connect?transport=webSockets&amp;connectionToken=c…OZxqiRQKOc%3D&amp;connectionData=%5B%7B%22name%22%3A%22alerthub%22%7D%5D&amp;tid=4'.
    jquery.signalR-2.0.0.min.js:8 [09:12:51 GMT-0600 (Central America
    Standard Time)] SignalR: Websocket opened.
    jquery.signalR-2.0.0.min.js:8 [09:12:51 GMT-0600 (Central America
    Standard Time)] SignalR: Now monitoring keep alive with a warning
    timeout of 13333.333333333332 and a connection lost timeout of 20000.</p>
  </blockquote>
  
  <p>The above log is all that happens, even after the client function is called form the server:</p>
  
  <pre><code>string dateTime;
  foreach(var connection in ConnectionMapping&lt;Guid&gt;.GetConnections(userId))
  {
      dateTime = SystemTime.Now().ToString();
      _alertHubContext.Clients.Client(connection).addAlert(alert.Id.Shrink(), title, url, dateTime);
  }
  </code></pre>
  
  <p>The other solutions all describe a situation where the developer was calling <code>start()</code> before wiring up client methods. However, I am not doing that.</p>
  
  <p>When the server method calls the client method, the console does not change at all. </p>
  
  <p>I believe I've narrowed it down to this:</p>
  
  <pre><code>Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext&lt;AlertHub&gt;().Clients.All.hi();
  </code></pre>
  
  <p>I created a basic client method called <code>hi()</code> which just pops an alert. This isn't even working.</p>
  
  <p>It seems that the connection is not being made to the client code when using the <code>GetHubContext</code> method to call the client methods.</p>