Chapter 4. Developing a Chat with Socket.IO
As we learned in the previous chapter, Node.js collaborates really well with frontend frameworks such as AngularJS. It's great that we can transfer data from the browser to Node.js and vice-versa. It's even better if we can do in this real time. Nowadays, real-time communication is heavily integrated in almost every web product. It gives a nice user experience and brings a lot of benefits to the application's owners. Usually, when we talk about real-time web components, we mean WebSockets. WebSocket is a protocol that allows us to establish a two-way (bidirectional) conversation between the browser and the server. This opens a whole new world and gives us the power to implement fast and robust apps. Node.js supports WebSockets, and we will see how to build a real-time chat with WebSockets. The application will use Socket.IO. It is a library that is built on top of WebSockets and provides mechanisms to cover the same functionalities...