Skip to main content

GameHost

The elected host user of a game (app). Election is deterministic across all cks-game-api replicas: among actors that are still fresh (recently heartbeated), the user whose earliest actor was created first wins, with a uuid tiebreaker. Row lifecycle is owned by Buddy (cks-udp-api); liveness (updated_at) is owned by game-api's actorHeartbeat mutation.

type GameHost {
hostUserId: BigInt!
actorCount: Int!
earliestActorJoinedAt: DateTime!
}

Fields

GameHost.hostUserId ● BigInt! non-null scalar

The user_id of the elected host. Stable while this user has at least one fresh row in actors for the app; the next-oldest user takes over automatically once the current host stops heartbeating (its rows age past HOST_ACTOR_FRESHNESS_SECONDS) or Buddy idle-evicts its last row.

GameHost.actorCount ● Int! non-null scalar

How many actors the host user currently owns in this app (always >= 1 when this object is returned).

GameHost.earliestActorJoinedAt ● DateTime! non-null scalar

Timestamp of the host's earliest still-connected actor (MIN(actors.created_at) for the host's group). Used as the primary election ordering key.

Returned By

actorHeartbeat mutation ● gameHost query