I am currently using a signalR hub class to connect people through chat. I was wondering what would be a good way to keep track of users connected to each other, if i match users up 1 to 1. So every time a user connects to the hub class he or she is randomly matched up and connected to a user, so i have to associate their connection id’s with each other. They also would need to be constantly changed once they are switching through users.
Share
SignalR has a concept called groups that allows you do distribute messages to certain people only with a simple programming model. You would have to add users to groups of the size two. Take a look at the section “Managing groups” in the official documentation:
http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-server
The important part is this – which means that you have to do (or can do – however you see it) your own housekeeping: