HTML over WebSockets: Build Real-Time SPAs with Barely Any JavaScript
HTML over WebSockets: real-time SPAs with barely any JavaScript
The article explores HTML over WebSockets, a pattern for building real-time SPAs with minimal JavaScript by sending pre-rendered HTML from the server. It contrasts this with traditional JSON APIs and compares it to HTTP and SSE variants. The author details advantages like single rendering engine, no API needed, server-side state, and real-time broadcast, while acknowledging drawbacks like resource usage and offline limitations. It includes a landscape of frameworks such as Phoenix LiveView, Django LiveView, and Hotwire, and offers guidance on choosing the right transport.
The same architecture that makes a chat trivial makes it immune to XSS.