Getting Started with GenServer

Let's define a public interface for the game server process.

We'll cover the following

GenServers are everywhere in the Elixir code. Becoming proficient with GenServer is one of the best things you can do to level up as an Elixir developer. It will require some work on our part. We’ll need to learn how client functions, module functions, and callbacks work and interact.

In general, however, implementing a GenServer is pretty straightforward. We’ll get lots of practice, so we’ll come out of it knowing our way around.

GenServer module

Let’s begin with a new file in the lib directory called lib/islands_engine/game.ex. This defines a new module that will become our GenServer.

Get hands-on with 1200+ tech skills courses.