title: Client not receiving SignalR message from controller
body: <p>I am trying to send a message from a controller to client(s) group using SignalR.
  When an event occurs in one of my controllers, I need to push a message using a signalr hub to be displayed like an alert on my clients screens.
  i know a lot of questions have been asked here, and I've read and tried a lot of them. Since I am new to SignalR some of them even already helped me to put things in place.
  At the moment everything seems in place. Clients can connect to the hub and join groups and controller can call methods from the hub. But the client never receive the message and I can't figure out why. I suspect that hub's method called by controller don't "see" the clients but I can't understand what's wrong.</p>
  
  <h1>Hub's code :</h1>
  
  <pre><code>public static class UserHandler
  {
      public static HashSet&lt;string&gt; ConnectedIds = new HashSet&lt;string&gt;();
  }
  
  [HubName("myHub")]
  public class MyHub : Hub
  {
      private static IHubContext hubContext = GlobalHost.ConnectionManager.GetHubContext&lt;MyHub&gt;();
      public void Notify(string groupName, string message)
      {
          Clients.Group(groupName).displayNotification(message);
      }
  
      public static void Static_Notify(string groupName, string message)
      {
          var toto = UserHandler.ConnectedIds.Count();
          hubContext.Clients.Group(groupName).displayNotification(message);
          hubContext.Clients.All.displayNotification(message);//for testing purpose
      }
  
      public Task JoinGroup(string groupName)
      {
          return Groups.Add(Context.ConnectionId, groupName);
      }
  
      public Task LeaveGroup(string groupName)
      {
          return Groups.Remove(Context.ConnectionId, groupName);
      }
  
      public override Task OnConnected()
      {
          UserHandler.ConnectedIds.Add(Context.ConnectionId);
          return base.OnConnected();
      }
  
      public override Task OnDisconnected(bool StopCalled)
      {
          UserHandler.ConnectedIds.Remove(Context.ConnectionId);
          return base.OnDisconnected(StopCalled);
      }
  }
  </code></pre>
  
  <h1>Here is the call from my controller :</h1>
  
  <pre><code>//(For simplification and readability I define here variables actually obtained by treating some data )
  //I already checked that problem did not come from missing data here
  string groupName = "theGroupName";
  string message = "My beautifull message.";
  
  //prepare signalR call
  var context = GlobalHost.ConnectionManager.GetHubContext&lt;MyHub&gt;();
  
  //Following commented lines are different attempts made based on exemples and answers I found here and on others sites.
  //The uncommented one is the one in use at the moment and is also based on an answer (from SO i think)
  
  //context.Clients.Group(_userEmail).displayNotification(message);
  //context.Clients.Group(_userEmail).Notify(_userEmail,message);
    MyHub.Static_Notify(_userEmail, message);
  </code></pre>
  
  <h1>And here is the client-side code :</h1>
  
  <pre><code>$(document).ready(function () {
      var userGroup = 'theGroupName';
      $.connection.hub.url = 'http://localhost/SignalRHost/signalr';
      var theHub = $.connection.myHub;
      console.log($.connection)
      console.log($.connection.myHub)
  
      theHub.client.displayNotification = function (message) {
          console.log('display message');
          alert(message);
      };
  
      $.connection.hub.start()
          .done(function () {
              theHub.server.joinGroup(userGroup);
              console.log("myHub hub started : " + $.connection.hub.id)
              console.log(theHub)
          })
          .fail(function () {
              console.log('myHub hub failed to connect')
          });
  
  });
  </code></pre>
  
  <p>Please help me understand what logic I failed to understand or what error I am missing.</p>
  
  <p><strong>EDIT :</strong></p>
  
  <p><em>To answer Alisson's comment:</em>
  The Startup.cs I forgot to show</p>
  
  <pre><code>public void Configuration(IAppBuilder app)
      {
          app.Map("/signalr", map =&gt;
          {
              map.UseCors(CorsOptions.AllowAll);
              var hubConfiguration = new HubConfiguration { };
              map.RunSignalR();
          });
      }
  </code></pre>
  
  <h1>Important stuff I forgot to mention too :</h1>
  
  <ul>
  <li>The Controller, the hub, and the client are 3 different projects (because of the global application architecture I had to separate hub logic)
  All are on my localhost IIS but on different ports</li>
  <li>I've set breakpoints on "OnConnected" and "onDiconnected" events and client connects and disconnects normally</li>
  </ul>