Urgent.News

What's breaking now, across thousands of outlets.

Tech

A Look at Datastar

Datastar is a Hypermedia framework that allows developers to build reactive web applications using server-sent events (SSE) instead of traditional WebSocket connections. This approach offers two key advantages over WebSocket: multiplexing SSE requests on top of existing HTTP connections and utilizing HTTP compression to reduce bandwidth usage.

Datastar's declarative syntax allows developers to bind HTML tags to signals, which are updated by the server via HTML or JSON patches. Signals are global to the page and can be namespaced using objects or special characters, while disabling automatic server-side updates for signals with names starting with an underscore.

The framework provides SDKs for various languages and frameworks, including Ruby, Elixir, and more. The server-side code for a Datastar application is simple, with a single request/response cycle to establish an SSE connection and send updates.

In summary, Datastar offers a unique approach to building reactive web applications, keeping state on the server and utilizing SSE for efficient data transmission. This allows developers to use any backend technology to build interactive web apps without being tied to a specific language or framework.

Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at noteflakes.com →

More in Tech

Fence the Human-Owned Paragraphs: A Markdown Contract for Model-Assisted Docs

The cheapest control you can put on a documentation generator is not a stricter prompt. It is a file format that gives the model no legal place to write except the prose blocks you hand it.

  • Human-authored paragraphs fenced to prevent model rewriting
  • Three block classes: Facts, Prose, Deprecations
  • Each block fenced with owner attribute and unique id

More from Thursday 5 November →