28.4 WebSockets
Ajax is quite nice, but not particularly performant; after all, the whole thing is still based on HTTP. With WebSockets or the WebSocket protocol, there is a possible alternative. This is a very high-performance, full-duplex communication protocol that enables data to be exchanged with the server in a very simple way. HTTP is still in play, but only for establishing the connection.
WebSockets have numerous advantages. In addition to better performance, the WebSocket protocol also offers bidirectionality, meaning that the server can continuously send data to the client even when a connection is established. The usual HTTP pull method (the client requests data, and only then does the server send it) naturally looks old in comparison. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access