title: Use SignalR as both a Hub and a Client in two ASP.NET Core 2.1 Razor web apps
body: <p>I have 2 ASP.NET Core Razor web apps. Each app will be using SignalR to communicate with web app clients and mobile clients. Because of my intended use, I have setup both web apps as Hub and Client, where the Client is using the .NET SignalR Client. Each of the 2 web apps have the following:</p>
  
  <pre><code>        static internal HubConnection Connection; // In the Startup class
  
          public Startup(IConfiguration configuration)
          {
              Configuration = configuration;
  
              Connection = new HubConnectionBuilder()
                   // Where the URL is for the OTHER web app
                  .WithUrl("https://localhost:44386/NotificationHub")
                  .Build();
          }
  </code></pre>
  
  <p>Each project also has a NotificationHub class, derived from Hub, in the Hubs folder.</p>
  
  <p>In the Startup ConfigureServices method in each app I have as the last statement:</p>
  
  <pre><code>services.AddSignalR();
  </code></pre>
  
  <p>In the Startup Configure method in each app I have the following immediately before the call to UseMvc:</p>
  
  <pre><code>app.UseSignalR(routes =&gt;
  {
      routes.MapHub&lt;NotificationHub&gt;("/NotificationHub");
  });
  </code></pre>
  
  <p>In each of the NotificationHub classes I have:</p>
  
  <pre><code>    public async Task SendMessage(string user, string message)
      {
          await Clients.All.SendAsync("ReceiveMessage", user, message);
      }
  </code></pre>
  
  <p>So, I am unsure how to initially connect from one Client to a Hub and I am also unsure if I am using the URL correctly.</p>