conv.

All stories
TechQuiet 2d · day 5 ↳ HTML Over the Wire

HTML over WebSockets gains traction as alternative SPA architecture

A blog post on sending pre-rendered HTML via WebSockets instead of JSON sparks debate over SPA design patterns.

What to know

  • HTML over WebSockets is a decades-old pattern gaining renewed attention, allowing servers to send pre-rendered HTML rather than JSON, reducing client-side rendering complexity.
  • The article cites Chris McCord's 2019 Phoenix LiveView as the modern origin, though earlier implementations existed in Rails; commenters note similar work predates the article's framing.
  • The technical community is divided: some argue WebSockets are necessary for low-latency stateful apps (chat, collaboration), while others contend SSE or HTTP with morphing libraries are simpler and sufficient for most use cases.
  • Unresolved tradeoffs include state preservation during DOM updates, binary data support, browser tab limits, and whether the approach truly eliminates API contracts or merely relocates them.

“instead of sending JSON and assembling the HTML in the browser, the server sends the HTML already built and the client just places it where it belongs.”

Andros, Article author · en.andros.dev blog · Aug 10

Chris McCord Creator of Phoenix frameworkAndros Technical writer and author

HTML over WebSockets gains traction as alternative SPA architecture
en.andros.dev

The record 2 press and posts · last 5 days

  1. HTML over WebSockets: real-time SPAs with barely any JavaScript: https:// en.andros.dev/blog/ef4968f5/ht… post · Mastodon · toot.community · newsyc250 · 2d ago
  2. parsed to here · Aug 14, 1:13 AM · 1 item above arrived after
  3. HTML over WebSockets: real-time SPAs with barely any JavaScript press · HN Best RSS · redbell · 4d ago · +1 outlet

The conversation 28 comments and posts from 1 site · verbatim · 196 claimed on the threads

The Hacker News discussion splits between pragmatists who value simplicity and context-dependent design, and engineers debating whether WebSockets or simpler alternatives (SSE, HTTP morphing, typed frameworks like Inertia.js) are the right default. There is skepticism about novelty—multiple commenters cite earlier jQuery/Rails implementations—alongside genuine technical disagreement over latency, in-order delivery, and state management.

The dispute Whether WebSockets are necessary or whether SSE + HTTP fetch (or htmx + morphing) provides the same latency and simplicity with less overhead; WebSocket advocates cite in-order delivery and stateful sessions, while skeptics note modern HTTP/2 multiplexing and point out the complexity of managing real-time DOM updates (state, scroll position, focus) remains unsolved.

many voices

HTML over WebSockets solves real problems for interactive apps; context and use case matter more than cargo-culting JSON SPAs.

  • “A lot of the people who oppose this technique don't understand context: The right solution to your problem often involves understanding the problem you're trying to solve!”

    gwbas1c · Hacker News
  • “In my case, I work on two Blazor websites… The server-side Blazor approach is for an internal web application that has a lot of quick-and-dirty pages…”

    gwbas1c · Hacker News
many voices

SSE is simpler and sufficient for most apps; WebSockets add unnecessary overhead and complexity.

  • “For most apps just use SSE and the built-in code for making HTTP requests (Fetch) instead of hacking up your own client side JS to make requests over a WebSocket.”

    hackingonempty · Hacker News
  • “HTTP doesn't guarantee in-order delivery. Websocket messages do. In-order delivery is important for stateful protocols.”

    josephg · Hacker News
some voices

Typed, data-driven frameworks (Vue/React + InertiaJS, Django Ninja) are better than minimizing JavaScript; the DOM should be a function of data.

  • “I use Django Ninja, Zod, InertiaJS+Vue and its as easy as using Django's templating engine, but static typing ensures my view doesnt emit unrepresentable data…”

    aitchnyu · Hacker News
  • “I used all of them in various projects… Then I found Inertia.js and never looked back.”

    felixding · Hacker News
some voices

This is not new; similar patterns existed years ago (jQuery, Rails Sync). The framing oversells novelty.

  • “I remember doing this with jQuery's $.ajax nearly 15 years ago. This seems comically overcomplicated in comparison.”

    lexicality · Hacker News
  • “Funny he mentioned Chris McCord as the originator of this technique with Liveview. The reality however predates that with Sync in Rails…”

    xutopia · Hacker News
Still unanswered
  • Does HTML over WebSockets truly eliminate API contracts, or just move them inside the WebSocket protocol layer?
  • How does DOM morphing handle complex state (filters, form input, scroll position) during live updates—is the complexity merely hidden?
  • Why not use WebTransport, which is bidirectional and lower-latency than WebSockets, as of 2026?