title: How to use SignalR 2 with WEB API, calling SignalR methods from API and from Clients
body: <p>I've been struggling for the past two days on how to get SignalR 2 to work with Web API. I tried to follow a few tutorials, from Microsoft and from others, about the topic, but still took me time to understand where I was wrong. I'm posting this question to help someone else that ends up in the same situation I was on.</p>
  
  <p>I needed to create a Hub on SignalR that could respond to a Console Application (C#) and a Web App (AngularJs) as clients, and I also needed it to send signals after a certain method on API being hit.</p>
  
  <p>I followed these (and others) tutorials:</p>
  
  <p><a href="https://docs.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/hubs-api-guide-server" rel="nofollow noreferrer">ASP.NET SignalR Hubs API Guide - Server (C#)</a></p>
  
  <p><a href="https://docs.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/hubs-api-guide-net-client" rel="nofollow noreferrer">ASP.NET SignalR Hubs API Guide - .NET Client (C#)</a></p>
  
  <p><a href="https://www.c-sharpcorner.com/article/stream-web-api-transactions-using-signalr/" rel="nofollow noreferrer">Stream Web API Transactions Using SignalR</a></p>
  
  <p>And some more, but those are the best I could find. Also, a dozen of others questions, here and on other sites.</p>
  
  <p>The best I could come up with was a solution that only answered to the API method being hit, but the clients wasn't able to fire any of the Hub's methods (they could only listen to it).</p>
  
  <p>This was my Hub's code:</p>
  
  <pre><code>public class MyHub : Hub
  {
      private static IHubContext hubContext =
      GlobalHost.ConnectionManager.GetHubContext&lt;MyHub&gt;();
  
      public static void GetStatus(string message)
      {
          hubContext.Clients.All.acknowledgeMessage($"GetStatus: {message}");
      }
  
      public void GetMessage(string message)
      {
          hubContext.Clients.User(id).acknowledgeMessage($"GetStatus: {message}");            
      }
  }
  </code></pre>
  
  <p>And my question was: How can I make the clients hit those methods on Hub, so they can get some personal response, if needed?</p>