title: SignalR 2.1.2 Cannot call server method from client, but can call client from server
body: <p>I'm not sure what is wrong here and it has to be something stupid simple. However I've checked over everything, tried several different things, all with no success.</p>
  
  <p>The server to client communication works great. No problems.</p>
  
  <p>But when I call <code>notifications.server.test();</code> I get nothing. Nada.</p>
  
  <p>I can call my testFunction() from the server and it works. but calling the hub's Test() method (which just calls testFunction) gives me nothing.</p>
  
  <p>Here is the hub:</p>
  
  <pre><code> namespace XXXX.Hubs
  {
      [HubName("monitoringHub")]
      public class MonitoringHub : Hub
      {
          [HubMethodName("sendCustomers")]
          public static void SendCustomers()
          {
              IHubContext context = GlobalHost.ConnectionManager.GetHubContext&lt;MonitoringHub&gt;();
              context.Clients.All.updateCustomers();
          }
  
          [HubMethodName("sendDetails")]
          public static void SendDetails(string SONumber)
          {
              IHubContext context = GlobalHost.ConnectionManager.GetHubContext&lt;MonitoringHub&gt;();
              context.Clients.All.updateDetails(SONumber);
          }
  
          [HubMethodName("test")]
          public static void Test()
          {
              IHubContext context = GlobalHost.ConnectionManager.GetHubContext&lt;MonitoringHub&gt;();
              context.Clients.All.testFunction();
          }
      }
  }
  </code></pre>
  
  <p>And the client code:</p>
  
  <pre><code>@section Scripts{
      &lt;script src="/Scripts/systemdetails.js"&gt;&lt;/script&gt;
      &lt;script src="/Scripts/jquery.signalR-2.1.2.js"&gt;&lt;/script&gt;
      &lt;!--Reference the autogenerated SignalR hub script. --&gt;
      &lt;script src="/signalr/hubs"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
      $(function () {
          // Declare a proxy to reference the hub.
          var notifications = $.connection.monitoringHub;
  
          //debugger;
          // Create a function that the hub can call to broadcast messages.
          notifications.client.updateDetails = function (sonumber) {
              getDetails(sonumber)
          };
  
          notifications.client.testFunction = function () {
              alert("Test Function");
          };
          // Start the connection.
          $.connection.hub.start().done(function () {
              //alert("connection started")
              getDetails(@Model.Customer.SONumber.ToString());
  
              setInterval(function (){
                  alert("Test Call");
                  notifications.server.test();
              }, 5000);
  
          }).fail(function (e) {
              alert(e);
          });
      });
  
      function getDetails(sonumber) {
          if(sonumber = (@Model.Customer.SONumber.ToString())){
              var tbl = $('#systemDetails');
              $.ajax({
                  url: '/Monitoring/GetDetails/@Model.Customer.SONumber.ToString()',
                  contentType: 'application/html ; charset:utf-8',
                  type: 'GET',
                  dataType: 'html',
                  cache: false
              }).success(function (result) {
                  storeVis();
                  tbl.empty().append(result);
              }).complete(function(){
                  recallVis();
              }).error(function () {
              });
          }
      }
  &lt;/script&gt;
  }
  </code></pre>
  
  <p>My interval function issues the alert as expected, It should then call the hub method which comes back and calls the testFunction to issue the second alert. I cannot get the second Alert to fire when I try to call the hub method from the client, but if I call the hub method (or the Clients.All.testFunction) on the server side, it works fine. What gives?</p>
  
  <p>On the server side I have tried different formats to call the server hub, but as it is now is how it should be according to the documentation for the version I'm on.</p>
  
  <p><code>notifications.client.test()</code> No.
  <code>notifications.test()</code> No.
  <code>notifications.server.test()</code> No.</p>