Gamehoster Browse Functions

The list a player chooses from before joining. See Browsing. The call returns a subscription handle: set its onChange and onError, and call cancel() to stop. There is just one thing to browse: an instance (a live room you can drop into).

Provisional: this tracks the frontend API as it settles.
FunctionReturnsonChange receives
Gamehoster.Browse.Instances()subscription handlearray of Instance

Browse.Instances takes no argument; it lists every open instance the game is running right now.

Usage

Set the handlers on the returned object; onChange fires once immediately with the current list and again every time it changes, until you cancel().

const instances = Gamehoster.Browse.Instances()
instances.onChange = list => renderInstanceList(list)
instances.onError  = err  => showError(err)

// when the menu closes
instances.cancel()
A subscription handle: onChange, onError, cancel()

The Instance object

A live room you can join. Browse.Instances yields an array of these; joining one returns the fuller live shape (see Instance).

{
  "id":       "i-7f3a2c",
  "phase":    "waiting",
  "players":  3,
  "capacity": 8,
  "access":   "open"
}
an Instance summary
FieldTypeDescription
idstringUnique id. Pass it to join this one.
phasestringThe instance's current phase. For pong, waiting, playing or over.
playersnumberHow many players are in it right now.
capacitynumberThe most it holds.
accessstringopen to drop straight in, or key when a password is needed to join.

Private rooms don't appear here. A player reaches one with its key.