Added mercure to update when everyone is ready

This commit is contained in:
Frank
2026-01-08 20:11:14 +01:00
parent 4d021e7cf1
commit 928ab3cbfe
5 changed files with 82 additions and 9 deletions
+16 -4
View File
@@ -336,8 +336,12 @@ class GameResponseService
if(is_null($activeGame))
return false;
$topic = $_ENV['MERCURE_TOPIC_BASE'] . '/game/hub-' . $activeGame;
$this->hub->publish(new Update($topic, json_encode([$sendTo, $message])));
$topic = $this->mercureTopicBase . '/game/hub-' . $activeGame;
try {
$this->hub->publish(new Update($topic, json_encode([$sendTo, $message])));
} catch (\Exception $e) {
// Mercure might be down
}
$this->updateChatTracking($player, (int)$sendTo);
@@ -381,7 +385,11 @@ class GameResponseService
$topic = $this->mercureTopicBase . '/game/hub-' . $session->getId();
$notification = "Security Alert: One of your verify codes was shared and has been regenerated.";
// We send it only to this player (screen)
$this->hub->publish(new Update($topic, json_encode([$screen, $notification])));
try {
$this->hub->publish(new Update($topic, json_encode([$screen, $notification])));
} catch (\Exception $e) {
// Mercure might be down
}
}
}
@@ -667,7 +675,11 @@ class GameResponseService
$topic = $this->mercureTopicBase . '/game/hub-' . $session->getId();
$message = "Mainframe Help Modus: Agents Doyle, Vega and Lennox rapports have been updated with coded messages.";
$this->hub->publish(new Update($topic, json_encode([0, $message])));
try {
$this->hub->publish(new Update($topic, json_encode([0, $message])));
} catch (\Exception $e) {
// Mercure might be down
}
}
}