I would like to know if is possible to create a chat for private conversation like gmail chat or hotmail.. How can I ensure that only client A talks with client B? How can I ensure that only logged clients can talk?
相关问题
- ASP.NET display progress bar during post back
- Can I use SignalR in my Winform c# app?
- signalR and large data transfer [closed]
- Why does an idle SignalR connection have 4-6 Mbps
- SignalR Client - The remote server returned an err
Look at
ChatWithTracking
in Basic chat sample, that's a great starting point for IM setupp.s: updated the link; using a search query in case they change the repo structure again
Each client connecting to a hub passes a unique connection id. You can retrieve this value in the Context.ConnectionId property of the hub context. If your application needs to map a user to the connection id and persist that mapping, you can use one of the following:
http://www.asp.net/signalr/overview/hubs-api/mapping-users-to-connections
Sure, you can create a unique "Group" each time a user initiates a chat with another user (or set of users). Then when you send messages to that group only those users would receive the message. You could also layer more security in front of sending messages to a group to ensure that the person sending the message is allowed to send a message to that group.
Try this application for Private chat with SignalR
Description of Application: http://www.aspbucket.com/2016/03/implement-of-private-one-to-one-chat.html
Download link https://github.com/shivam01990/SignalR-private-one-to-one-chat