v0.1.0 GameApp.ServerSupervisor

A dynamic supervisor that supervises child GameApp.Server processes.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Starts a game server with the given shortcode and creator(player).

Stops a game server with the given shortcode.

Link to this section Functions

Link to this function

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

start_game(shortcode, player, config \\ %GameConfig{})

start_game(String.t(), GameApp.Player.t(), GameApp.Config.t()) ::
  {:ok, pid()} | {:error, any()}

Starts a game server with the given shortcode and creator(player).

Returns {:ok, pid} or {:error, any}.

Examples

iex> GameApp.ServerSupervisor.start_game("ABCD", %{id: "Gamer"})
{:ok, pid}
Link to this function

stop_game(shortcode)

stop_game(String.t()) :: :ok | {:error, :not_found}

Stops a game server with the given shortcode.

Returns :ok or {:error, :not_found}.