Connect the Channel to the Game

Here’s where we begin to do the real work of getting our new game channel talking to the game server. We’re going to build out new clauses of handle_in/3 that correspond to the public interface functions we wrote for IslandsEngine.Game. We’ll pick the right communication strategy for each action, and we’ll continue to check our work at each step, both in the browser consoles and in IEx.

The mechanics of making these connections is so easy, it’s going to feel like cheating. When we’re done, all the actions a player can take in the game will be exposed on the web through a channel interface.

For all of these new actions, we’re going to follow the same pattern we used for the "hello" function. We’ll define a new ...

Get Functional Web Development with Elixir, OTP, and Phoenix now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.