Modern web applications usually require real-time communication where data is continuously flowing from client to server and vice versa with (almost) no delay.
The HTML5 WebSocket Protocol was created to fulfill this requirement. WebSocket uses a single TCP connection that is kept open even when the server or client is not sending any data. That means, while a connection between the client and the server exists, data can be sent at any time without having to open a new connection to the server.
Real-time communication has several applications from building chat applications to multi-user games, where the response time is really important.
In this chapter, we will focus on learning how to build a real-time web application using Socket.IO (https://socket.io) and understanding the Node.js event-driven architecture.
Socket.IO is one of the most used libraries for implementing...