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
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.
alive?(id)
read_state(id)
read_state(id, fun)
send_command(id, command)
server_alive?(id)
start_server(id, opts \\ [])
Starts a Mogs.Board handled by the callback module Board
stop_server(id, reason \\ :normal, timeout \\ :infinity)
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.