title: Send signalr message from server to all clients
body: <p>This is related to <a href="https://stackoverflow.com/questions/7549179/signalr-posting-a-message-to-a-hub-via-an-action-method">SignalR + posting a message to a Hub via an action method</a>, but my question is a bit different:</p>
  
  <p>I'm on version 0.5.2 of signalr, using hubs. In older versions, you were encouraged to create methods on the hub to send messages to all clients, which is what I have:</p>
  
  <pre><code>public class MyHub : Hub
  {
      public void SendMessage(string message)
      {
          // Any other logic here
          Clients.messageRecieved(message);
      }
  
      ...
  }
  </code></pre>
  
  <p>So in 0.5.2, I want to send a message to all the clients (say from somewhere in the controller). How can I get access to the <code>MyHub</code> instance?</p>
  
  <p>The only way I've seen referenced is:</p>
  
  <pre><code>var hubContext = GlobalHost.ConnectionManager.GetHubContext&lt;MyHub&gt;();
  hubContext.Clients.messageRecieved("hello");
  </code></pre>
  
  <p>Which is fine, but I want to call the method on my hub.</p>