Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8883227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:45:52+00:00 2026-06-14T20:45:52+00:00

I want to be able to send messages to a specific client, I have

  • 0

I want to be able to send messages to a specific client, I have working code but I cannot find a way to identify users, as on each page load/refresh the client id will change, so I cannot rely on that.
I have tried to append a querystring to the connection, but I have only been able to find the querystring of the same context.

This is my hub, and within the send method i want to be able to match the id that is sent in to a particular connection id at the point of sending the message:

public class Chat : Hub
{
    public string addMsg()
    {
        return "";
    }

    public void Send(string message, string id)
    {

        Clients.Client(Context.ConnectionId).receiveMessage(message);
    }
}

Here is my client code, i want to pass the id of the person to send a message to to the server send method, and use the querystring value of the other connected user to match it to the id i am sending.

var chat = $.connection.chat;

chat.client.receiveMessage = function (message) {
  alert("Received from server: " + message);
};

chat.addMsg = function (message) {

};

$("#sendMessage").click(function () {
  chat.server.send($('#newMessage').val(), 6);
});

$.connection.hub.qs = "id=1";

$.connection.hub.start().done(function () {
  var myClientId = $.connection.hub.id;
  var qs = $.connection.hub.qs;
});

I hope my question makes sense, I have been trying to crack this for a while now, below are some links to some of the articles i have used to get to where i am now, I am just missing the last piece of the puzzle, please go easy on me 🙂

http://weblogs.asp.net/davidfowler/archive/2012/11/11/microsoft-asp-net-signalr.aspx

SignalR- send data to a specific client

https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:45:53+00:00Added an answer on June 14, 2026 at 8:45 pm

    I don’t think this is going to work the way you want it to. The connection ID is just that — an identifier for a particular connection. SignalR itself doesn’t know anything about authenticating users. It is, however, built on top of ASP.NET and all of your familiar authentication methods (Windows, Forms, etc.) work as you would expect.

    Once ASP.NET has authenticated the user, you have access to this in your hubs as Context.User. It’s now up to you to maintain a mapping between this user and one or more connection IDs. Besides browser refreshes, you might need to deal with a user accessing your service from multiple browsers or machines. Sending a message to this user means sending it to all of those browsers and machines.

    Jabbr does all this and more. You really should take a look at that code for a good way to implement this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to have individual users send messages to each other
I have an app where we want users to be able to send us
For my new app Im working on I want to be able to send
I want to be able to send arbitrary messages from my iphone to the
I want to be able to send messages to a remote JBoss server (JBoss
Users are able to send each other messages on my Ruby app. The table
In the website on which I'm working, users may send messages to each other.
I am developing an application where I want to be able to send messages
I want to be able to send formatted text (i.e., text with format spans)
I'm creating a abstractFactory class and I want to be able to send the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.