mogs v0.1.1 Board

Link to this section Summary

Functions

The player_id and data arguments can be anything and will be passed to your board c:handle_add_player/3 callback.

Starts a Mogs.Board handled by the callback module Board

Add a pid to the players tracking system. Unlinke add_player, it will no call your c:handle_add_player/3 callback, nor any other callback.

Link to this section Functions

Link to this function

add_player(id, player_id, data, track \\ self())

The player_id and data arguments can be anything and will be passed to your board c:handle_add_player/3 callback.

If the tracker feature is enabled.

Although player_id and data can be anything, player_id will be used to identify an unique player and should be kept minimal.

If called with 3 arguments, the calling process pid will be tracked. Since player are considered "lefters" after a timeout, it is fine to initialize the tracking with a short living process (e.g. from a Phoenix controller). On the other end it is strongly unadvised to track long living processes that do not "belong" to a single player.

The pid to track can be set as the 4th argument.

Link to this function

read_state(id, fun)

Link to this function

send_command(id, command)

Link to this function

server_alive?(id)

Link to this function

start_server(id, opts \\ [])

Starts a Mogs.Board handled by the callback module Board

Link to this function

stop_server(id, reason \\ :normal, timeout \\ :infinity)

Link to this function

track_player(id, player_id, pid \\ self())

Add a pid to the players tracking system. Unlinke add_player, it will no call your c:handle_add_player/3 callback, nor any other callback.

Link to this function

whereis_server(id)