Exemple #1
0
 public IActionResult AddRoom([FromServices] IHubContext <ChatHub> context, string name)
 {
     context.Clients.All.SendAsync("MessageReceived", name);
     rooms.AddRoom(new Room()
     {
         roomName = name
     });
     return(RedirectToAction("Index"));
 }
Exemple #2
0
 public void AddRoom(string roomName)
 {
     rooms.AddRoom(new Room(roomName));
     Clients.All.SendAsync("MessageReceived", roomName);
     Groups.AddToGroupAsync(Context.ConnectionId, roomName);
 }