mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-15 13:26:10 +00:00
Handle authenticated room instance takeover
This commit is contained in:
@@ -22,6 +22,7 @@ class RoomStateChanged implements ShouldBroadcastNow
|
||||
public readonly RoomStateChange $change,
|
||||
public readonly ?array $state = null,
|
||||
public readonly ?int $affectedPlayerId = null,
|
||||
public readonly ?string $affectedInstanceId = null,
|
||||
) {}
|
||||
|
||||
public function broadcastOn(): Channel
|
||||
@@ -35,7 +36,7 @@ class RoomStateChanged implements ShouldBroadcastNow
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{version: int, change: string, state: array<string, mixed>|null, affected_player_id?: int}
|
||||
* @return array{version: int, change: string, state: array<string, mixed>|null, affected_player_id?: int, affected_instance_id?: string}
|
||||
*/
|
||||
public function broadcastWith(): array
|
||||
{
|
||||
@@ -49,6 +50,10 @@ class RoomStateChanged implements ShouldBroadcastNow
|
||||
$payload['affected_player_id'] = $this->affectedPlayerId;
|
||||
}
|
||||
|
||||
if ($this->affectedInstanceId !== null) {
|
||||
$payload['affected_instance_id'] = $this->affectedInstanceId;
|
||||
}
|
||||
|
||||
return $payload;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user