Files
4Gewinnt/API/Controllers/GameController.cs
T

16 lines
420 B
C#

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
});
}
}