Server-sent events for push communication
Now that we know we can control the flow of information from the server, we are entering the territory of being able to build some great features for our web applications.
In the old days, when our application wanted to check the state of something, it would need to poll the web server by repeatedly sending the same request over and over again. We talked about building a music web application. We learned how we could display content, get information, and even stream some content to listen to music. Of course, the next step is to make the application social because we want to share our music with our friends. We want to add a feature that will list who is online and the name of the song they are listening to. Refreshing the page constantly would work but is a bad experience. Polling constantly by sending the same request over and over again also works, but this eats up resources and is also not a great experience.
What would be better...