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

Chapter 3. Having Two-Way Conversations

In this chapter, we will cover the following recipes:

  • Creating a simple chat room
  • Managing the socket life cycle
  • Emitting a private message to another socket
  • Sending messages to all the sockets, except for the sender
  • Building a multiplayer tic-tac-toe game

Introduction

Although we can perform some interesting things with one-way communication, the real power of Socket.IO begins to show when the client and server are both participants in a constant dialog.

In this chapter, we will work through various examples of two-way Socket.IO communication. We will implement various tactics to make bidirectional communication work for our specific needs.

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