title: Sending messages from Server to clients in SignalR 2.0
body: <p>I am learning SignalR and it pretty simple. However, I am having a problem sending Messages from Server to client.</p>
  
  <p>My Hub class is as follows:</p>
  
  <pre><code>public class UpdateHub : Hub
  {
      private readonly UpdateBroadcast _broadcaster;
  
      public UpdateHub() : this(UpdateBroadcast.Instance) { }
  
      public UpdateHub(UpdateBroadcast broadCaster)
      {
          _broadcaster = broadCaster;
      }
  }
  </code></pre>
  
  <p>And I am calling this hub in my broadcaster class like this:</p>
  
  <pre><code>public class UpdateBroadcast
  {
      private readonly static Lazy&lt;UpdateBroadcast&gt; _instance = new Lazy&lt;UpdateBroadcast&gt;(
      () =&gt; new UpdateBroadcast(GlobalHost.ConnectionManager.GetHubContext&lt;UpdateHub&gt;()));
  
      private IHubContext _context;
  
      private UpdateBroadcast(IHubContext context)
      {
          _context = context;
      }
  
      public static UpdateBroadcast Instance
      {
          get { return _instance.Value; }
      }
  
      public void UpdatePost(Post post)
      {
          _context.Clients.All.updatePost(post);
      }
  
  }
  </code></pre>
  
  <p>In my MVC Controller I am calling the UpdatePost method:</p>
  
  <pre><code>public JsonResult AddPost(Post post)
  {
      UpdateBroadcast broadcaster = UpdateBroadcast.Instance;
      Post result = dbFunctions.AddPost(post);
      broadcaster.UpdatePost(post);
      return Json(new { success = result != null  }, JsonRequestBehavior.DenyGet);
  }
  </code></pre>
  
  <p>When I debug the code, I can see that UpdatePost is executed but there is no activity on the client side. My client-side function is like this:</p>
  
  <pre><code>$(function () {    
      var update = $.connection.updateHub;
      update.client.updatePost = function (data) {
          alert("called update post");
      };
  });
  </code></pre>
  
  <p>I don't seem to understand what is causing this.</p>