yep
This commit is contained in:
@@ -77,6 +77,11 @@ public class SessionsController : ControllerBase
|
||||
return Ok(await this.queryRespository.ReadSessionPlayerCount(this.User.GetShogiUserId()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetch the session and latest board state. Also subscribe the user to socket events for this session.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{name}")]
|
||||
public async Task<ActionResult<ReadSessionResponse>> GetSession(string name)
|
||||
{
|
||||
@@ -113,6 +118,7 @@ public class SessionsController : ControllerBase
|
||||
session.AddPlayer2(User.GetShogiUserId());
|
||||
|
||||
await sessionRepository.SetPlayer2(name, User.GetShogiUserId());
|
||||
await communicationManager.BroadcastToAll(new SessionJoinedByPlayerSocketMessage());
|
||||
return this.Ok();
|
||||
}
|
||||
return this.Conflict("This game already has two players.");
|
||||
@@ -144,6 +150,8 @@ public class SessionsController : ControllerBase
|
||||
return this.Conflict(e.Message);
|
||||
}
|
||||
await sessionRepository.CreateMove(sessionName, command);
|
||||
|
||||
// Send socket message to both players so their clients know that new board state is available.
|
||||
await communicationManager.BroadcastToPlayers(
|
||||
new PlayerHasMovedMessage
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user