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