using Microsoft.AspNetCore.SignalR;

namespace API.Controllers;

public class GameController : Hub
{
    public async Task JoinGame(string gameId, string playerName)
    {
        await Groups.AddToGroupAsync(Context.ConnectionId, gameId);
        await Clients.Group(gameId).SendAsync("PlayerJoined", new
        {
            ConnectionId = Context.ConnectionId,
            PlayerName = playerName
        });
    }
}