title: How do you send out from SignalR Hub from another class in the same project?
body: <p>Background:  I'm on .Net 6 running the latest and greatest from the built-in SignalR package.  I installed @microsoft/signalr and the JS side of things works fine for Client -&gt; Server communications.  The issue is my Server -&gt; Hub communications.</p>
  <p>I have a class that after updating some information and needs to broadcast out to whomever is listening that &quot;this object was updated&quot;.  Below is what I'm talking about.</p>
  <pre><code>public class SignalRRunner
  {
      public SignalRRunner(ICompanyDIContainer companyContainer)
      : base(companyContainer)
      {
      }
  
      public Task RunItAsync(Signal signal)
      {            
          if (signal.userId.HasValue)
          {
              // Do work on the thing, update the db, etc. here
  
              await ChatHub.Static_Send(&quot;debug&quot;, &quot;users&quot;, &quot;accounts&quot;, userObject);
              return Task.FromResult(true);
          }
  
          return Task.FromResult(false);            
      }
  }
  </code></pre>
  <p>In my hub:</p>
  <pre><code>public static async Task Static_Send(string group, string whoUpdate, string whatUpdate, object payload)
  {
      if (string.IsNullOrWhiteSpace(group))
      {
          group = &quot;debug&quot;;
      }
  
      await Clients.Group(group).SendAsync(&quot;OnDebug&quot;, payload, new CancellationToken());
  }
  </code></pre>
  <p>Due to limitations imposed from my company, I cannot directly inject the IHubContext into the constructor of anything as they use their own version of DI in the project and it always throws an exception when I've tried.  I've tried making the function non-static, registering the ChatHub in startup.cs, and resolving it in the class that's doing the work, but the Clients are null and this throws an error.  Every other solution I've read suggests using the GlobalHost.ConnectionManager.GetHubContext to get the HubContext from inside the static method, but that's no longer part of SignalR so that's out. How do I send messages to the ChatHub from another class inside the same project?</p>