WebSockets is a standard that has existed since 2011 when the RFC-6455 was published. This protocol establishes a permanent full-duplex connection between a browser and a server over a single TCP connection. The protocol is widely supported at the time when this tutorial is being written. You can check on the Can I Use website.
So much for a short introduction. My motivation for using WebSockets was that I needed a webpage that is periodically updated. The first option I used was Ajax requests to the server. However, the timing was so inaccurate that I had to search for an alternative and came up with a solution using WebSockets which worked perfectly when it came to accuracy and latency. The implementation I use for this tutorial is written in the Apache Wicket framework.