LANGUAGES Signal 515
HTML over WebSockets moves rendering to the server, eliminating JSON APIs and dual codebases
An architectural pattern where the server sends pre-rendered HTML over a persistent bidirectional WebSocket channel, allowing SPA-like applications with minimal client-side JavaScript.
This approach consolidates rendering logic on the server in a single language, eliminating the need for separate API contracts and dual codebases. It trades client-side rendering complexity for server-side resource usage and a persistent connection model, offering an alternative to the standard SPA stack.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
Three transport variants exist for HTML-over-the-wire: HTTP (htmx, Unicorn), SSE (Datastar), and WebSockets (Phoenix LiveView, Django LiveView), with WebSockets being the only bidirectional option.
The client still runs JavaScript, but only to establish the WebSocket channel and place received HTML fragments, not to render views or parse JSON.
The server can push updates without client requests since the WebSocket channel remains open, enabling real-time updates without polling.
THE CLUSTER