title: SignalR not invoking method on server
body: <p>I'm using AngularJS to create a SignalR service that connects to the hub that I specify and exposes the <code>.on</code> and <code>.invoke</code> methods so my controllers can listen for events from the server and invoke methods on the server.</p>
  
  <p>Here's the relevant part of my service:</p>
  
  <pre><code>        return {
              on: function (eventName, callback) {
                  hub.on(eventName, function (result) {
                      $root.$apply(function () {
                          if (callback) {
                              callback(result);
                          }
                      });
                  });
              },
              ready: function (callback) {
                  return isLoaded.then(function () {
                      callback();
                  });
              },
              invoke: function (methodName, args, callback) {
                  return hub.invoke.apply(hub, $.merge([methodName], $.makeArray(args))).done(function (result) {
                      $root.$apply(function () {
                          if (callback) {
                              callback(result);
                          }
                      });
                  });
              },
              connection: connection
          };
  </code></pre>
  
  <p>My hub is connecting perfectly, however when I try to call my invoke, nothing happens. Here's where I call it:</p>
  
  <pre><code>    var chatHub = hub('chatHub');
  
      chatHub.on('userConnected', function (user) {
          console.log(user);
      });
  
      chatHub.ready(function () {
          chatHub.invoke('Connect', [ // also tried 'connect' here
              { Name: $root.auth.profile.name, Picture: $root.auth.profile.picture },
              { RoomKey: $routeParams.roomKey, RoomID: $routeParams.roomId }
          ]);
      });
  </code></pre>
  
  <p>So if you look at the <code>.ready()</code> function that is returned from my service, it uses a promise that when it's resolved will execute my callback passed to it. That works great (the promise <code>isLoaded</code> is resolved in my connection.start().done() which is called inside my service when it's instantiated, so it'll only execute the callback after it's successfully connected)</p>
  
  <p>It gets to my <code>.invoke</code> method (I've confirmed this with console.log), but never invokes the method on the hub, below:</p>
  
  <pre><code>public class ChatHub : Hub {
      public async void Connect(User user, Room room) {
          // ommitted
      }
  }
  </code></pre>
  
  <p>The objects I pass to it have this structure: </p>
  
  <pre><code>public class Room {
      public int RoomKey { get; set; }
      public string RoomID { get; set; }
      public string Name { get; set; }
      public string Description { get; set; }
      public List&lt;User&gt; Users { get; set; }
      public List&lt;Message&gt; Messages { get; set; }
  }
  
  public class User {
      public string Name { get; set; }
      public string Picture { get; set; }
  }
  </code></pre>
  
  <p>So I don't think it's an issue with my arguments, since nothing is required on them so it won't complain that I only passed a few of the arguments (the only ones I need).</p>
  
  <p>For clarity's sake, in my <code>chatHub.invoke('Connect', ...)</code> I'm using the case it is on the server based upon this code I found in my <code>~/signalr/hubs</code> file (I don't need this since I don't use the generated proxy, I just included it for the meantime so I could inspect their underlying code)</p>
  
  <pre><code>    proxies['chatHub'] = this.createHubProxy('chatHub'); 
      proxies['chatHub'].client = { };
      proxies['chatHub'].server = {
          connect: function (user, room) {
              return proxies['chatHub'].invoke.apply(proxies['chatHub'], $.merge(["Connect"], $.makeArray(arguments)));
          }
      };
  </code></pre>