title: How to obtain connection ID of signalR client on the server side?
body: <p>I need to get the connection ID of a client. I know you can get it from the client side using <code>$.connection.hub.id</code>. What I need is to get in while in a web service I have which updates records in a database, in turn displaying the update on a web page. I am new to signalR and stackoverflow, so any advice would be appreciated. On my client web page I have this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(function () {
          // Declare a proxy to reference the hub. 
          var notify = $.connection.notificationHub;
  
          // Create a function that the hub can call to broadcast messages.
          notify.client.broadcastMessage = function (message) {
              var encodedMsg = $('&lt;div /&gt;').text(message).html();// Html encode display message.
              $('#notificationMessageDisplay').append(encodedMsg);// Add the message to the page.
          };//end broadcastMessage
  
          // Start the connection.
          $.connection.hub.start().done(function () {
              $('#btnUpdate').click(function () {
                  //call showNotification method on hub
                  notify.server.showNotification($.connection.hub.id, "TEST status");
              });
          });
  
  
      });//End Main function
  
  
  &lt;/script&gt;
  </code></pre>
  
  <p>everything works up until I want to update the page using signalR. The show notification function in my hub is this:</p>
  
  <pre><code>//hub function
  public void showNotification(string connectionId, string newStatus){               
      IHubContext context = GlobalHost.ConnectionManager.GetHubContext&lt;notificationHub&gt;();
      string connection = "Your connection ID is : " + connectionId;//display for testing
      string statusUpdate = "The current status of your request is: " + newStatus;//to be displayed
      //for testing, you can display the connectionId in the broadcast message
      context.Clients.Client(connectionId).broadcastMessage(connection + " " + statusUpdate);
  }//end show notification
  </code></pre>
  
  <p>how can I send the connectionid to my web service?</p>
  
  <p>Hopefully I'm not trying to do something impossible. Thanks in advance.</p>