24 lines
619 B
C#
24 lines
619 B
C#
using API.Services.GameManager;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
namespace API.Controllers;
|
|
|
|
public class GameHubSocket(IGameManager gameManager) : Hub
|
|
{
|
|
private readonly IGameManager _gameManager = gameManager;
|
|
|
|
public async Task CreateGame(string playerName)
|
|
{
|
|
// TODO: create
|
|
await Groups.AddToGroupAsync(Context.ConnectionId, "gameId");
|
|
await Clients.Group("gameId").SendAsync("PlayerJoined", new
|
|
{
|
|
Context.ConnectionId,
|
|
PlayerName = playerName
|
|
});
|
|
}
|
|
|
|
public async Task JoinGame(string gameId, string playerName)
|
|
{
|
|
}
|
|
} |