GenServer and Application
Learn how to implement a GenServer for the game logic.
We'll cover the following...
GenServer
Definition
GenServer
is an Elixir Behaviour that wraps its Erlang counterpart, :gen_server
. The GenServer
Behaviour automatically creates default implementations of the :gen_server
callbacks so that we only write code specific to our GenServer
. We’ll use the Elixir GenServer
as we build our game server, which will spare us from writing a lot of boilerplate.
Job
The GenServer
Behaviour processes provide most of what we want from services, and also address problems services create. They are separate Elixir processes that listen for and respond to messages from other processes. They can hold state ...