title: Can SignalR group be shared between different hubs?
body: <p>After finding <a href="https://github.com/SignalR/SignalR/issues/1039" rel="nofollow noreferrer">this update</a> around communicating with groups, it appears that a group is keyed off the hub name. If this is correct (please let me know if I'm mistaken) is there any way for a hub to access another hub's group or better yet to have some kind of global group?</p>
  <p>My problem is that I have one hub that adds the client to a group:</p>
  <pre><code>public class GameService : Hub, IGameService
  ...
  public void CreateNewGame(CreateGameDto game)
      {
          game.Creator = UserRepo.GetUser(Context.ConnectionId);
          var newGame = GameRepo.CreateNewGame(game);
          Groups.Add(Context.ConnectionId, newGame.GameId.ToString(CultureInfo.InvariantCulture));
          Clients.Caller.JoinedGame(newGame);
      }
  </code></pre>
  <p>and another hub entirely needs to broadcast to that group:</p>
  <pre><code>    public class MessagingService : Hub , IMessageService
      ...
          public void AddMessage(MessageDto message)
      {
          message.User = UserRepo.GetUser(Context.ConnectionId);
          MessageRepo.AddMessage(message);
          Clients.Group(message.User.GameId.ToString(CultureInfo.InvariantCulture))
              .ReceivedMessage(message);
      }
  </code></pre>
  <p>As of right now, the client is never receiving this broadcast.</p>
  <p><strong>Edited to add the client code.</strong>
  Here is the client side signalr setup, I've created a framework that allows me to use the service interface with a Castle Dynamic Proxy so that I'm not calling services and methods by string name.</p>
  <pre><code>public abstract class BaseClientProxy&lt;TServer,TClient&gt;
  {
      public  TServer ServiceProxy;
  
      protected BaseClientProxy(HubConnection conn)
      {
          ServiceProxy = CreateProxy(conn);
      }
  
      private ProxyGenerator _generator;
      protected IHubProxy Proxy;
      protected TClient Receiver;
  
      protected TServer CreateProxy(HubConnection conn)
      {
          Proxy = conn.CreateHubProxy&lt;TServer&gt;();
  
          _generator = new ProxyGenerator();
  
          return (TServer)_generator.CreateInterfaceProxyWithoutTarget(typeof(TServer), new HubProxyInterceptor(Proxy));
      }
  
      public void SetReceiver(TClient receiver)
      {
          Receiver = (TClient)_generator.CreateInterfaceProxyWithTarget(typeof(TClient), receiver);
          RegisterEvents();
      }
  
      protected void RegisterEvents()
      {
          Action&lt;MethodInfo&gt; regAction = RegisterEvent&lt;object&gt;;
          var methods =
              typeof (TClient).GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public);
          foreach (var methodInfo in methods)
          {
              var locInfo = methodInfo;
              if (locInfo.GetParameters().Length &gt; 0)
              {
                  var regMethod = typeof(BaseClientProxy&lt;TServer, TClient&gt;).GetMethodExt(regAction.Method.Name, typeof(MethodInfo));
                  var genAction = regMethod.MakeGenericMethod(locInfo.GetParameters()[0].ParameterType);
                  genAction.Invoke(null, new object[] { locInfo });
              }
              else
              {
                  Proxy.On(locInfo.Name, () =&gt;locInfo.Invoke(Receiver, null));
              }
          }
      }
  
      protected void RegisterEvent&lt;TDto&gt;(MethodInfo method)
      {
          Proxy.On&lt;TDto&gt;(method.Name, x =&gt; method.Invoke(Receiver, new object[] {x}));
      }
  }
  
  public class HubProxyInterceptor : IInterceptor
  {
      protected IHubProxy Proxy;
  
      public HubProxyInterceptor(IHubProxy proxy) 
      {
          Proxy = proxy;
      }
  
      protected async void Invoke&lt;TDto&gt;(string methodName, TDto dto)
      {
          await Proxy.Invoke(methodName, dto);
      }
  
      protected async void Invoke(string methodName)
      {
          await Proxy.Invoke(methodName);
      }
  
      public void Intercept(IInvocation invocation)
      {
          if (invocation.Arguments.Length &gt; 0)
          {
              Invoke(invocation.Method.Name, invocation.Arguments[0]);
          }
          else
          {
              Invoke(invocation.Method.Name);
          }
      }
  }
  </code></pre>
  <p>Theses snippets are from a singleton class that establishes the connection and registers the services in a windsor container.</p>
  <pre><code>private SignalRManager()
      {
          var settings = Settings.GetSettings&lt;IClientSettings&gt;(ConfigurationManager.AppSettings);
  
          Connection = new HubConnection(settings.SignalRServerUri);
  
          ioc = new WindsorContainer();
          ioc.Register(
              Component.For&lt;BaseClientProxy&lt;IUserService, IUserClient&gt;&gt;().Instance(new UserServiceProxy(Connection)),
              Component.For&lt;BaseClientProxy&lt;IDrawingService, IDrawingClient&gt;&gt;().Instance(new DrawingServiceProxy(Connection)),
              Component.For&lt;BaseClientProxy&lt;IMessageService, IMessageClient&gt;&gt;().Instance(new MessageServiceProxy(Connection)),
              Component.For&lt;BaseClientProxy&lt;IScoreBoardService, IScoreBoardClient&gt;&gt;().Instance(new ScoreBoardServiceProxy(Connection)),
              Component.For&lt; BaseClientProxy&lt;IGameService,IGameClient&gt;&gt;().Instance(new GameServiceProxy(Connection)));
          Connection.Start().Wait();
      }
     public TClient GetService&lt;TClient,TReceiver&gt;(TReceiver receiver) where TClient : IService
      {
          var proxy = ioc.Resolve&lt;BaseClientProxy&lt;TClient, TReceiver&gt;&gt;();
          proxy.SetReceiver(receiver);
          return proxy.ServiceProxy;
      }
  </code></pre>
  <p>In this code the HubProxyInterceptor is responsible for making all calls to the server.</p>
  <p>And the RegisterEvents method within the BaseClientProxy is responsible for wiring up the calls from the server to the client.  The TServer and TClient type parameters are 2 different but similar interfaces, TServer will be implemented by the Hub class on the server side and TClient is implemented by my WPF view model which is what is passed in in the call to SetReceiver.</p>