Last post Apr 25, 2017 03:08 AM by Eric Du
None
0 Points
7 Posts
Apr 24, 2017 09:51 AM|vinodkus|LINK
Hi,
I am very new to SignalR.
I am working on chat application.
I want to chat with one particular client.
To chat with particular client,
I have to do like that
Clients.Client(connectionId).addChatMessage(name + ": " + message);
I can collect all connection id and send message to particular connection.
But Suppose, There are three persons A,B, C
All are connected.
In A screen, B and C are looking.
To send message from A to B. A should has knowledge which connection id belongs to B.
So How A can find hub connection id of B.
If you didn't understand my problem please say to me.
Please help me.
Its urgent
Thanks in Advance
Contributor
6730 Points
2715 Posts
Apr 25, 2017 03:08 AM|Eric Du|LINK
Hi vinodkus,
After read your description, I know you want to get the connection id of the client.
I think you could use Context.ConnectionId to get the connection id. For more details, please refer to the following tutorial:
Mapping SignalR Users to Connections:
https://docs.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/mapping-users-to-connections
Here are someone who meet the similar problem as you, please check:
How to obtain connection ID of signalR client on the server side?
http://stackoverflow.com/questions/20908620/how-to-obtain-connection-id-of-signalr-client-on-the-server-side
Best Regards,
Eric Du
None
0 Points
7 Posts
How to find hub connection id of another client
Apr 24, 2017 09:51 AM|vinodkus|LINK
Hi,
I am very new to SignalR.
I am working on chat application.
I want to chat with one particular client.
To chat with particular client,
I have to do like that
Clients.Client(connectionId).addChatMessage(name + ": " + message);
I can collect all connection id and send message to particular connection.
But Suppose, There are three persons A,B, C
All are connected.
In A screen, B and C are looking.
To send message from A to B. A should has knowledge which connection id belongs to B.
So How A can find hub connection id of B.
If you didn't understand my problem please say to me.
Please help me.
Its urgent
Thanks in Advance
Contributor
6730 Points
2715 Posts
Re: How to find hub connection id of another client
Apr 25, 2017 03:08 AM|Eric Du|LINK
Hi vinodkus,
After read your description, I know you want to get the connection id of the client.
I think you could use Context.ConnectionId to get the connection id. For more details, please refer to the following tutorial:
Mapping SignalR Users to Connections:
https://docs.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/mapping-users-to-connections
Here are someone who meet the similar problem as you, please check:
How to obtain connection ID of signalR client on the server side?
http://stackoverflow.com/questions/20908620/how-to-obtain-connection-id-of-signalr-client-on-the-server-side
Best Regards,
Eric Du
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.