优化websocket连接

This commit is contained in:
2026-04-24 15:25:15 +08:00
parent 2ce128e63a
commit 203e478b65
6 changed files with 47 additions and 2 deletions

View File

@@ -52,6 +52,7 @@ class Live extends Backend
$topics = [
'admin.live.snapshot',
'admin.live.opened',
'jackpot.hit',
'period.tick',
'period.locked',
'period.opened',

View File

@@ -385,14 +385,24 @@ final class GameLiveService
}
self::publishPublicPeriodOpened((string) $record['period_no'], $finalNumber, $now);
self::publishPublicPeriodPayout((string) $record['period_no'], $finalNumber, $payoutUntil);
$jackpotHits = is_array($settleOut['jackpot_hits'] ?? null) ? $settleOut['jackpot_hits'] : [];
GameWebSocketEventBus::publish('admin.live.opened', [
'period_id' => $rid,
'period_no' => (string) $record['period_no'],
'result_number' => $finalNumber,
'payout_until' => $payoutUntil,
'jackpot_hits' => is_array($settleOut['jackpot_hits'] ?? null) ? $settleOut['jackpot_hits'] : [],
'jackpot_hits' => $jackpotHits,
'server_time' => $now,
]);
if ($jackpotHits !== []) {
GameWebSocketEventBus::publish('jackpot.hit', [
'period_id' => $rid,
'period_no' => (string) $record['period_no'],
'result_number' => $finalNumber,
'hits' => $jackpotHits,
'server_time' => $now,
]);
}
self::publishSnapshot(null);
return [
@@ -618,7 +628,6 @@ final class GameLiveService
{
$snapshot = self::buildSnapshot($recordId);
self::publishPublicPeriodTick($snapshot);
GameWebSocketEventBus::publish('admin.live.snapshot', $snapshot);
}
/**