ELSEIF
Your brief EB
437 stories from 95 feeds 255 clusters Refreshed 4 minutes ago next pull 18:36

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.

WHY IT MATTERS

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 source

The three things worth knowing

01

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.

02

The client still runs JavaScript, but only to establish the WebSocket channel and place received HTML fragments, not to render views or parse JSON.

03

The server can push updates without client requests since the WebSocket channel remains open, enabling real-time updates without polling.

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
andros.dev via Hacker News HTML over WebSockets: real-time SPAs with barely any JavaScript Open ↗