[match] support a cluster of tachyon servers

This commit is contained in:
Devin Zuczek
2026-09-01 10:55:47 -04:00
parent cae0ebd4ae
commit 2af5d5089d
6 changed files with 201 additions and 33 deletions
+13 -9
View File
@@ -53,17 +53,21 @@ export type Env = SharedHonoEnv & {
/** The Photon Chat application id. Optional; see {@link Env.PHOTON_REALTIME_APP_ID}. */
PHOTON_CHAT_APP_ID?: string
/**
* The Tachyon voice server the client is handed as `voiceConnectionInfo` on
* `GET /player/connection-info`, as `host:port` (e.g. `66.228.47.217:7777`).
* Optional, and EMPTY when unset — no separate voice server. Not a secret (the
* client receives it in the clear), so a plain var like the Photon ids.
* The pool of Tachyon servers sessions are spread across — a COMMA-SEPARATED list of
* `host:port` entries (e.g. `66.228.47.217:7777,66.228.47.217:7778,45.79.2.10:7777`).
* One entry is a single server, which is the common case. Optional, and EMPTY when
* unset — no separate voice server, and the connection info's voice fields stay empty.
* Not a secret (the client receives it in the clear), so a plain var like the Photon
* ids.
*
* A room instance is assigned one entry for its lifetime and every player in it is
* handed that one, derived from the instance id rather than stored — see
* `tachyonServerFor` in match.app.ts, which also explains what changing this list does
* to sessions already running. The `voiceServerId` the client displays is GENERATED
* from an entry's position (`tachyon-1`, `tachyon-2`, …), so the same address may be
* listed twice to model two server slots on one box.
*/
TACHYON_HOST_PORT?: string
/**
* The id of that voice server, handed to the client as `voiceServerId` (e.g.
* `server-1`). Optional; see {@link Env.TACHYON_HOST_PORT} — set both or neither.
*/
TACHYON_NAME?: string
/**
* The Photon region every session is pinned to — both the region named in the connection
* info and the one stamped on every room instance, which must agree. Optional; unlike the