QueryHost
Documentation menu

Response contract

Result semantics

QueryHost separates normalized server facts, typed game data, untouched protocol data, and source provenance.

Discriminated resultTypeScript
const result = await query({ game: "project-zomboid", host });

if (result.ok) {
  result.server;  // fields shared across games
  result.data;    // ProjectZomboidData
  result.rawData; // untouched A2S Rules, when available
} else {
  result.error;   // stable QueryError
}

Normalized server fields

server contains only concepts shared honestly across games: name, map, version, password state, player counts, and the primary query round-trip time. Every property is optional because a protocol may not confirm it.

Game-specific data

data is selected by the canonical game ID. Rust tags, Minecraft MOTDs and plugins, Project Zomboid mods, and FiveM resources stay in their game-specific types rather than being flattened into a vague common object.

Untouched protocol data

rawData is optional and intentionally separate. Current A2S profiles use it for the exact Rules map when that source succeeds. Interpreted values remain in data; raw keys are not promoted into the normalized server contract.

Partial success

Required-source failure produces ok: false. If the required source succeeds while optional enrichment times out, is blocked, or is malformed, the result remains successful withpartial: true, source reports, and warnings.

Timing

  • server.queryRttMs measures the primary protocol exchange, not ICMP ping.
  • durationMs measures the entire operation, including discovery and optional sources.
  • Each source can include its own rttMs when an exchange completed.