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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.