Interface: HostDetection
Defined in: system/host.ts:28
The type of Host: the election and its result.
Properties
host
readonlyhost:MapPlayer|undefined
Defined in: system/host.ts:41
The elected player: undefined until the election resolved.
Methods
detectHost()
detectHost(
options?):Promise<MapPlayer>
Defined in: system/host.ts:39
Elects the host, once: every call returns the same Promise, and only
the first call's options count. The election starts at the gameStart
stage, or at the call when the game already started. Call it on every
client, in the same order relative to the other sync requests, as
SyncRequest requires.
Parameters
options?
The timeout; ten seconds by default.
Returns
Promise<MapPlayer>
A Promise that resolves with the elected player, the same on
every client, and rejects only when no lobby time arrived.