This commit is contained in:
2023-01-29 16:53:26 -06:00
parent 8a25c0ed35
commit e2eff4f8b5
5 changed files with 35 additions and 15 deletions

View File

@@ -11,7 +11,7 @@ namespace Shogi.UI.Shared;
public class ShogiSocket : IDisposable
{
public event AsyncEventHandler? OnSessionCreated;
public event AsyncEventHandler? OnSessionJoined;
public event AsyncEventHandler<SessionJoinedByPlayerSocketMessage>? OnSessionJoined;
public event AsyncEventHandler<PlayerHasMovedMessage>? OnPlayerMoved;
private readonly ClientWebSocket socket;
@@ -76,7 +76,8 @@ public class ShogiSocket : IDisposable
case SocketAction.SessionJoined:
if (this.OnSessionJoined is not null)
{
await this.OnSessionJoined();
var args = JsonSerializer.Deserialize<SessionJoinedByPlayerSocketMessage>(memory[..result.Count], serializerOptions);
await this.OnSessionJoined(args!);
}
break;
case SocketAction.PieceMoved: