I have made a new project and selected individual user accounts authentication and MVC project. Then I went on the home view, deleted all the template information in the main body and added a load of actionlinks with the names of chat rooms I want to implement. They are simply chatroom1, chatroom2 etc. There will be a set number so I dont want users to define the room names.
Moving on I then implemented a simple hub class as given in http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-server
What I want is to click on the links from the home page and they join you to that chat room. I think it is best if they are defined as groups rather than hubs, but I don't understand where to put the joining code...
I have this as my hub
public class ContosoChatHub : Hub
{
public Task JoinGroup(string groupName)
{
return Groups.Add(Context.ConnectionId, groupName);
}
public Task LeaveGroup(string groupName)
{
return Groups.Remove(Context.ConnectionId, groupName);
}
}
But where do I define where to add the user? In the controller or view (in which case which view), and moreover how! I've been looking for hours for a tutorial I can implement in this way. I also want to know how to set the username as the username registered.
Any help/guidance would be hugely appreciated