title: SignalR call to specific client from controller ASP.NET Core 2.1
body: <p>I need to send an instant message from the server to the client after the user has submitted a form in a browser.</p>
  
  <p>I followed the Microsoft steps <a href="https://docs.microsoft.com/en-us/aspnet/core/tutorials/signalr?view=aspnetcore-2.1&amp;tabs=visual-studio" rel="noreferrer">here</a> to set up a signalR connection, created a Hub class, signalr.js etc. </p>
  
  <p>The problem is that I can only invoke a message to all clients, but I need to invoke the message to the specific caller who initiated the request (otherwise everyone will get the message).</p>
  
  <p>This is my POST Action in the HomeController.cs:</p>
  
  <pre><code>[HttpPost]
      [ValidateAntiForgeryToken]
      public async Task&lt;IActionResult&gt; Submit(string signalRconnectionId, Dictionary&lt;string, string&gt; inputs)
      {
          //Invoke signal to all clients sending a message to initSignal WORKS FINE
          await _signalHubContext.Clients.All.SendAsync("initSignal", "This is a message from the server!");
  
          //Invoke signal to specified client where signalRConnectionId = connection.id DOES NOT WORK
          await _signalHubContext.Clients.Client(signalRconnectionId).SendAsync("initSignal", "This is a message from server to this client: " + signalRconnectionId);
  
          return RedirectToAction("Success", inputs);
      }
  </code></pre>
  
  <p>my client javascript file:</p>
  
  <pre><code>    //Create connection and start it
  const connection = new signalR.HubConnectionBuilder()
      .withUrl("/signalHub")
      .configureLogging(signalR.LogLevel.Information)
      .build();
  connection.start().catch(err =&gt; console.error(err.toString()));
  
  console.log("connectionID: " + connection.id);
  $("#signalRconnectionId").attr("value", connection.id);
  
  //Signal method invoked from server
  connection.on("initSignal", (message) =&gt; {
  
      console.log("We got signal! and the message is: " + message);
  
  
  });
  </code></pre>
  
  <p>I have tried debugging the action method and I get correctly passed in the connectionId which is "0" (incrementing by 1 per connection)</p>