This chapter covers how to use Websockets in Java to create real-time applications supporting millions of concurrent users. Websockets provide a bidirectional persistent connection to a HTTP web server so that the time taken to create HTTP connections can be reduced. HTTP 1.1 also allows long-lived connections through the keep-alive header, but the payload in each request is significantly bigger than Websockets.
There are often comparisons done to Websockets versus HTTP/2 with Server Side Events (SSE). HTTP/2 allows request multiplexing at the connection level ...