title: SignalR with MVC4, cannot push from action on controller
body: <p>I have a MVC4 application setup to test SignalR push notification and which is not working. (I have tested the chat application on the MVC official site and its working perfectly, the problem is when i pushing a message from controller). Please someone help me on this.</p>
  
  <p>(1) I have startup cs as follows,</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using Microsoft.Owin;
  using Owin;
  
  namespace MvcApplication3
  {
      public class Startup
      {
          public void Configuration(IAppBuilder app)
          {
              app.MapSignalR();
          }
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p>(2) Hub class</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using Microsoft.AspNet.SignalR;
  using Microsoft.AspNet.SignalR.Hubs;
  
  namespace MvcApplication3
  {
      [HubName("notificationHub")]
      public class NotificationHub : Hub
      {
  
      }
  }
  </code></pre>
  
  <hr>
  
  <p>(3) what im doing on controller is,</p>
  
  <pre><code>public ActionResult Index()
  {
      SendMessage("This should be displayed on client !!");
      return View();
  }
  
  private void SendMessage(string message)
  {
      var context = GlobalHost.ConnectionManager.GetHubContext&lt;NotificationHub&gt;();
      context.Clients.All.viewMessage(message);
  }
  </code></pre>
  
  <hr>
  
  <p>(4) Finally on the Index view,</p>
  
  <pre><code>&lt;style type="text/css"&gt;
      #span-display
      {
          color: red;
          font-size: 16px;
      }
  &lt;/style&gt;
  
  &lt;span id="span-display"&gt;&lt;/span&gt;
  
  @section scripts
  {
      &lt;script src="~/Scripts/jquery.signalR-2.0.1.min.js"&gt;&lt;/script&gt;
      &lt;script src="~/signalr/hubs"&gt;&lt;/script&gt;
  
      &lt;script type="text/javascript"&gt;
          $(function () {
  
              var notificationhub = $.connection.notificationHub;
  
              notificationhub.client.viewMessage = function (message) {
  
                  $('#span-display').html(message);
              };
  
              $.connection.hub.start();
  
          });
  
      &lt;/script&gt;
  }
  </code></pre>
  
  <p>please do help me guys , im on a deadline and couldn't solve this out. Please excuse me if this is a simple thing but im new to this technology.</p>
  
  <p>Thank you in advance :-)</p>