title: sharepoint 2013 signalr
body: <p>Following program is based on the idea given by following post:</p>
  
  <p><a href="http://spmatt.wordpress.com/2012/04/12/harnessing-signalr-in-sharepoint/" rel="nofollow">http://spmatt.wordpress.com/2012/04/12/harnessing-signalr-in-sharepoint/</a></p>
  
  <p>Since Sharepoint 2013 is based on .NET 4, no further configuration is required to use the SignlaR </p>
  
  <p>library. I tried to use Microsoft.AspNet.SignalR.Core version 1.0. The item added and item </p>
  
  <p>edited event class was bind to the Project List. So whenever I created a new project item, it will </p>
  
  <p>be automatically trigger the JavaScript in the web part as stated in the post stated above.</p>
  
  <p>The item added event code is defined as follow:</p>
  
  <pre><code>public override void ItemAdded(SPItemEventProperties properties)
  {
  ...
  var connectionManager = GlobalHost.ConnectionManager;
  var srContext = connectionManager.GetHubContext("messagehub");
  srContext.Clients.Add.addMessage();
  ...
  }
  </code></pre>
  
  <p>The messagehub class is defined as follow:</p>
  
  <pre><code>public class messagehub : Hub { 
      public void Send(string message)
      {
          // Call the addMessage method on all clients
          Clients.All.addMessage(message);
      } 
  }
  </code></pre>
  
  <p>The messagehub is saved in the same package. When I added a new item in the project list,</p>
  
  <p>the itemadded event will be triggered. Error comes up at the GetHubContext statement that said </p>
  
  <p>that messagehub could not be resolved.</p>
  
  <p>How could I resolve this issue?</p>