title: How to inject reference to IHubContext for.NET Core HostBuilder?
body: <p>I have a self-hosted Microsoft.Azure.WebJobs Azure Function that I am hosting in a Linux Docker container.  At the moment the function is simply processing data from a ServiceBus.  This all works fine.  However, I'd like to be able to post the results of the data processing to certain web clients via Azure SignalR.  I have the Azure SignalR instance set up and can connect to it from my various web clients.</p>
  
  <p>What I'm stuck with, is how to send messages to the SignalR hub from my function.</p>
  
  <p>I have added the SignalR and AzureSignalR services via HostBuilder (and the appropriate connection string is in the appsettings.json file):</p>
  
  <pre><code>using Microsoft.Extensions.DependencyInjection;
  using Microsoft.Extensions.Hosting;
  using Microsoft.Extensions.Logging;
  
  namespace InSysWebJobHubDataProcessor
  {
      class Program
      {
          static void Main(string[] args)
          {
              var builder = new HostBuilder();
              builder.ConfigureWebJobs(b =&gt;
              {
                  b.AddAzureStorageCoreServices();
                  b.AddServiceBus();
              });
              builder.ConfigureServices(b =&gt;
              {
                  **b.AddSignalR().AddAzureSignalR();**
              });
  
              var host = builder.Build();
              using (host)
              {
                  host.Run();
              }
          }
     }
  }
  </code></pre>
  
  <p>I believe I had to inject a reference to IHubContext somehow, but do not know how to do this.</p>
  
  <p>How do I add a reference to IHubContext and then access it from within the Function.Run method when needed?</p>