Chapter 8Beyond Request/Response

The most common kind of client/server communication in web apps, which has been our focus up to this point, is achieved by sending an HTTP request and asynchronously receiving a single HTTP response. These requests and responses are always processed as a pair. But there are more options you should consider.

In this final chapter, you’ll learn how htmx simplifies the use of WebSockets[75] and server-sent events.[76] This will enable you to implement web applications where a single request from the browser can trigger the server to send multiple responses over time. Web apps can utilize this to display updated information without having to send repeated requests.

WebSockets are a standardized protocol for two-way ...

Get Server-Driven Web Apps with htmx now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.