O'Reilly logo

Socket.IO Cookbook by Tyson Cadenhead

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a multiplayer tic-tac-toe game

We can observe the real power of Socket.IO by using it in a multiplayer game. Although there are many examples of multiplayer games we could implement, tic-tac-toe is one of the more simple games.

The game board is always three tiles long and three tiles tall. The goal is for either user to select any three tiles in a row.

Our final user interface will look something similar to the following image:

Building a multiplayer tic-tac-toe game

Our game will allow any number of players to join and be paired with another player. The paired players will be able to interact on the board together in real time.

Getting ready

In this recipe, we will use jQuery for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required