Hi to all. I was looking for examples to find a solution for my problem. Basicall What I am trying to do is send notification or message to a specific client.
But I saw that I have no control on client connectionId. So How can I solve this kind of problem with SignalR or at least can u give one example about that. The example might be about chat client to client or send a notification to a specific user.
groups doesnt really matter, signalr keeps its own records for who is in which group, there may be some performance issue with the many duplicates but modern hardware should be more than sufficient.
as for active connections, this doesnt affect since its purely a record
that said, it depends on which version of signalr you are using (i'm basing it on 1.0) and you might want to confirm it with a load test of sorts
Basicall What I am trying to do is send notification or message to a specific client.
You can do that. You can use Clients.Client() method for that. Pass the connection ID of specific client to the
Client() method.
gokhanartuk
But I saw that I have no control on client connectionId.
Why not? When each client opens the web application, you can maintain an
static ConcurrentDictionary to keep the IDs. Get the ID using the SignalR client library (using $.connection.hub.id). Then call a server method from $.connection.hub.start().done() method. In that server method,
add the client id in to the dictionary. $.connection.hub.start().done() will call whenever a user opens the application.
gokhanartuk
So How can I solve this kind of problem with SignalR or at least can u give one example about that. The example might be about chat client to client or send a notification to a specific user.
gokhanartuk
0 Points
3 Posts
Notify and send message to selected client.
Feb 20, 2013 06:05 PM|LINK
Hi to all. I was looking for examples to find a solution for my problem. Basicall What I am trying to do is send notification or message to a specific client.
But I saw that I have no control on client connectionId. So How can I solve this kind of problem with SignalR or at least can u give one example about that. The example might be about chat client to client or send a notification to a specific user.
Thanx for all replies.
kwanann
Contributor
3816 Points
750 Posts
MVP
Re: Notify and send message to selected client.
Feb 20, 2013 09:40 PM|LINK
one possible way to do this, is to add the client to a group which only has himself inside, then you broadcast to that group
e.g userid = user123
add user123 to the group user123 (same as userid)
then when you want to send a message to the user, send to the group user123
View my blog @ http://jefferytay.wordpress.com
gokhanartuk
0 Points
3 Posts
Re: Notify and send message to selected client.
Feb 20, 2013 09:50 PM|LINK
So in this point a question pop in my mind which is performance issue.
If I follow a way like that. Would it be cause any performance problem or it is not relavent with the performance.
I hope I made my point clear.
kwanann
Contributor
3816 Points
750 Posts
MVP
Re: Notify and send message to selected client.
Feb 20, 2013 09:53 PM|LINK
groups doesnt really matter, signalr keeps its own records for who is in which group, there may be some performance issue with the many duplicates but modern hardware should be more than sufficient.
as for active connections, this doesnt affect since its purely a record
that said, it depends on which version of signalr you are using (i'm basing it on 1.0) and you might want to confirm it with a load test of sorts
View my blog @ http://jefferytay.wordpress.com
Ruchira
All-Star
43056 Points
7040 Posts
MVP
Re: Notify and send message to selected client.
Feb 21, 2013 12:11 PM|LINK
Hello,
You can do that. You can use Clients.Client() method for that. Pass the connection ID of specific client to the Client() method.
Why not? When each client opens the web application, you can maintain an static ConcurrentDictionary to keep the IDs. Get the ID using the SignalR client library (using $.connection.hub.id). Then call a server method from $.connection.hub.start().done() method. In that server method, add the client id in to the dictionary. $.connection.hub.start().done() will call whenever a user opens the application.
You can refer my blogpost below
http://ruchirac.blogspot.com/2013/02/creating-chat-application-in-aspnet.html
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.