title: Sending a message from Controller to SignalR Hub
body: <p>I have a MVC 3, VB.NET, Razor app that uses SignalR for a chat and system message system... The chat works flawlessly but I would like to be able to add a function in my admin controller that will send messages to the hub which the hub will then do its normal thing as if the Javascript had called it from a view...The hub is set up as below:</p>
  
  <pre><code>Imports SignalR.Hubs
  Imports SignalR
  
  Namespace SingalRTest
   Public Class Chat
      Inherits Hub
      Public Sub Send(ByVal clientName As String, ByVal message As String)
          'Call the addMessage method on all clients.
          Clients.addMessage(clientName, message)
      End Sub
  
   End Class
  End Namespace
  </code></pre>
  
  <p>I thought about simply using NEW but that wont work because as I understand it the instance of the hub has to remain intact.. </p>
  
  <p>What i am trying to do is something like this:</p>
  
  <pre><code> Public Function notification(ByVal systemMessage as string)
          Dim y As SingalRTest.Chat = Nothing
          y.Send(User.Identity.Name.ToString, systemMessage)
          Return RedirectToAction("Index", "Admin")
   End Function
  </code></pre>
  
  <p>This will not work at all and errors saying:</p>
  
  <pre><code>  Object reference not set to an instance of an Object
  </code></pre>
  
  <p>when it gets to the y.Send line...</p>