hub location mercure adjustment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Frank van den Berg
2026-06-28 23:09:35 +02:00
co-authored by Claude Sonnet 4.6
parent 831603e04e
commit aa56617e50
5 changed files with 9 additions and 15 deletions
+3 -6
View File
@@ -17,7 +17,6 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Mercure\HubInterface;
use Symfony\Component\Mercure\Update;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
final class GameDashboardService
{
@@ -26,8 +25,6 @@ final class GameDashboardService
private readonly SessionRepository $sessionRepository,
private readonly EntityManagerInterface $entityManager,
private readonly HubInterface $hub,
#[Autowire('%env(MERCURE_TOPIC_BASE)%')]
private readonly string $mercureTopicBase,
) {
}
@@ -330,7 +327,7 @@ final class GameDashboardService
$this->entityManager->flush();
try {
$topic = $this->mercureTopicBase . '/game/hub-' . $session->getId();
$topic = '/game/hub/' . $session->getId();
$this->hub->publish(new Update($topic, json_encode(['type' => 'player_ready', 'player' => $player->getScreen(), 'ready' => !$setting])));
} catch (\Exception $e) {
// Mercure might be down, but we don't want to crash the game
@@ -382,7 +379,7 @@ final class GameDashboardService
if ($anyReset) {
$this->entityManager->flush();
try {
$topic = $this->mercureTopicBase . '/game/hub-' . $session->getId();
$topic = '/game/hub/' . $session->getId();
$this->hub->publish(new Update($topic, json_encode(['type' => 'player_ready'])));
} catch (\Exception $e) {
// Mercure might be down
@@ -416,7 +413,7 @@ final class GameDashboardService
}
try {
$topic = $this->mercureTopicBase . '/game/hub-' . $session->getId();
$topic = '/game/hub/' . $session->getId();
$this->hub->publish(new Update($topic, json_encode(['type' => 'all_ready'])));
} catch (\Exception $e) {
// Mercure might be down, but we don't want to crash the game