46 lines
1.6 KiB
Markdown
46 lines
1.6 KiB
Markdown
---
|
|
type: guide
|
|
title: Event Window
|
|
description: How the live event countdown is computed and surfaced via REST + SSE.
|
|
tags: [guide, event, countdown, sse]
|
|
timestamp: 2026-07-21T18:28:00Z
|
|
---
|
|
|
|
# Configuration
|
|
|
|
Two `setting` rows control the window:
|
|
|
|
| Setting key | Default (seeded) | Description |
|
|
|-------------------|------------------|--------------------------------------------|
|
|
| `eventStartUtc` | `now + 60s` | ISO 8601 instant the event becomes live. |
|
|
| `eventEndUtc` | `now + 7d` | ISO 8601 instant the event ends. |
|
|
|
|
Both are seeded by `SeedSystemData1700000000100` and editable through
|
|
`SettingsService`.
|
|
|
|
# State computation
|
|
|
|
`EventStatusService.getStatus(now)` (`backend/src/common/services/event-status.service.ts`)
|
|
returns one of three branches:
|
|
|
|
| Condition | `status` | `countdownMs` |
|
|
|-------------------------|----------|----------------------|
|
|
| `now < eventStartUtc` | `Stopped` (countdown) | `eventStartUtc - now` |
|
|
| `now ∈ [start, end]` | `Running` | `eventEndUtc - now` |
|
|
| `now >= eventEndUtc` | `Stopped` (ended) | `0` |
|
|
|
|
# Endpoints
|
|
|
|
* `GET /api/v1/event/status` — one-shot read (see
|
|
[System Endpoints](/api/system.md)).
|
|
* `GET /api/v1/event/stream` — SSE stream that pushes the same payload
|
|
whenever `SseHubService.publish()` is called (typically by an admin
|
|
cron tick). The SPA subscribes to keep the countdown ticking without
|
|
polling.
|
|
|
|
# See also
|
|
|
|
- [Auth and Settings Tables](/database/auth-settings.md)
|
|
- [System Endpoints](/api/system.md)
|
|
- [Scoreboard Stream](/guides/scoreboard-stream.md)
|