Chapter 10. Adding Real-time Chat

In the previous two chapters, we extended our social network by adding new features to create pages and share posts. In this chapter, we will discuss real-time communication between users in the system. The technology that we are going to use is called WebSockets. The plan for this part of the book is as follows:

  • Getting to know WebSockets
  • Bringing Socket.IO to the project
  • Preparing the UI of the chat area
  • Exchanging messages between the client and the server
  • Sending messages to the user's friends only
  • Customizing the output of the chat

Getting to know WebSockets

WebSockets is a technology that opens a two-way (bidirectional) interactive channel between the server and the browser. By using this type of communication, ...

Get Node.js By Example 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.