title: hubcontext is null signalr
body: <p>At the moment I have learned how to notify the hub from the serverside. The hub then broadcasts the notification to the client.</p>
  
  <p>My context that I am working on is based on sending a friend request (similar to facebook). 
  Where if Mr X sends a request to Ms Y, then only Ms Y will have a notification pop up.</p>
  
  <p>Thus I decided to work with Groups. I am thinking one group - one user.</p>
  
  <p>The problem is that I tried that on hub start i would do:</p>
  
  <p>$.connection.hub.start(function () { hub.login(XXX);});</p>
  
  <p>where XXX would be the username or userID from the session. I don't know how to do this.</p>
  
  <p>I then tried to make a hidden label with the username or userID, fill it on page_load and then take it from the client side. But client side works before server side.</p>
  
  <p>I then tried to use the connection id of the hub context. But the problem seems to be that almost everything such as context and group manager are null in the hub. Is it because I am using an instance of the hub? or because I have static methods? (which I need to have static/ or else have an instance since I am calling these methods from other server side code)</p>
  
  <pre><code>     using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using SignalR.Hubs;
  using SignalR;
  using SignalR.Hosting.AspNet;
  using System.Web;
  using System.Web.SessionState;
  
  namespace DataLayer
  {
      public class NotificationHub: Hub
      {
          private static NotificationHub instance;
  
          private NotificationHub() { }
  
          public static NotificationHub Instance
          {
              get
              {
                  if (instance == null)
                      instance = new NotificationHub();
                  return instance;
              }
          }
  
          public void NotifyClients(int gid, string value)
          {
              IConnectionManager connectionManager = (IConnectionManager)AspNetHost.DependencyResolver.GetService(typeof(IConnectionManager));
              dynamic clients = connectionManager.GetClients&lt;NotificationHub&gt;();
              clients[gid.ToString()].newNotification(value);
              //let us then try to use connection id, but this.Context.ConnectionId is null
  
          }
  
          public void Login(string gid)
          {
              AddToGroup(gid);
          }
  
      }
  }
  </code></pre>
  
  <p>May be there is some other workaround to what I would like to do? (i.e. letting each person have their own notifications?)</p>