Exploring WebSockets and Socket.IO
Let's say that we want to build a chat feature. The first thing that we should do is to develop the part that shows the messages on the screen. In a typical scenario, we want these messages to be delivered fast, that is, almost immediately after they were sent. However, if we don't use sockets to receive the data from the server, we need to make an HTTP request. Also, the server should keep the information till we request it to do so. So, imagine what would happen if we had 10 users and each one of them starts sending data.
We need to maintain a user session in order to identify the user's requests. These problems are easily solved if we use sockets. Once the socket is opened, we have a long live channel, and we can send messages back and forth. This means that you can start receiving information without requesting it. The architecture is analogous to a big net of bridges. The bridge is always open, and if we need to go somewhere, we are free to do so....