adds round telemetry support

This commit is contained in:
2026-09-17 14:35:42 -04:00
parent 8e04a190b3
commit 858704bb10
12 changed files with 191 additions and 3 deletions
+28 -1
View File
@@ -97,7 +97,34 @@ reconciliation; this change does not immediately rewrite or restart them.
Servers with an unknown map retain their existing config behavior. Rollback
restores the exact prior config bytes.
## Tests
## Round telemetry experiment
Send `POST /api/telemetry` with `Content-Type: application/json` to the Electric
Cherry host (port 3000 in local development):
```bash
curl http://localhost:3000/api/telemetry \
-H 'Content-Type: application/json' \
-d '{"event":"round_change","round":17,"server":"t5_zombie_prototype_1","players":4}'
```
The server must already be registered in Electric Cherry. `round` and `players`
are required nonnegative integers. Success returns HTTP 200 with
`{ "ok": true, "telemetry": { "server": "...", "round": 17, "players": 4, "receivedAt": "..." } }`.
Invalid payloads return 400, unknown/destroyed servers 404, and non-JSON content
types 415. This endpoint uses the app's existing LAN/Tailscale access model;
there is no API key requirement.
The latest report is saved across app restarts and streamed immediately to the
dashboard and server detail page, including after browser reconnection. The UI
labels it as the last reported round with its age: round-change events alone
cannot detect a stopped script or a match ending. Send the initial round on each
new match, then each round change. The latest received request wins (including
lower rounds for new matches); there is no event ordering or history yet.
Telemetry player counts are displayed with the report and never replace RCON
occupancy or affect automated restart gates.
## Running tests
```bash
npm test