Skip to content

← Guides

Add live server updates

Introduce Datastar and SSE only when the task requires server-authoritative patches. The Advanced index documents transport patterns, server routes, and attention-respecting defaults.

Progressive ladder

  1. 1. Server-authoritative HTML

    Start with complete server-rendered regions and stable element ids. Persistent state, permissions, and validation belong to the server.

    Build a server-rendered app

  2. 2. Datastar transport

    Local signals are useful for transient presentation; durable updates return HTML or SSE patches from application routes.

    Advanced Datastar recipes

  3. 3. SSE status streams

    Long-lived streams patch stable status elements as a job, order, or upload advances. Prefer event-driven pushes over surprise periodic polling.

    SSE status stream demo

  4. 4. Attention-respecting updates

    Use aria-live sparingly for genuinely changing data. Do not surprise users with unprompted movement, auto-advancing carousels, or demo intervals treated as product defaults.

    Advanced attention notes

Attention-respecting defaults

  • Prefer explicit user-initiated refresh or genuinely event-driven server pushes over unprompted periodic SSE.
  • Mark live regions with aria-live only when content changes after load and the update is meaningful to the task.
  • Documentation demo intervals are not product defaults—production applications should not surprise users with movement on a fixed cadence.
  • When enhancement fails, complete server-rendered HTML and ordinary navigation remain the fallback.

Open the Advanced Datastar + SSE index for runnable examples, server route patterns, and recipe coverage.

Common live-update recipes

  • Active search

    Debounced signal request; server replaces a live results region.

    See Advanced

  • Inline validation

    Server validates a field and streams field/error fragments; native validation stays first.

    See Advanced

  • Progress and realtime status

    Long-lived SSE patches stable status elements as a job advances.

    See Advanced

  • Filter, sort, and data views

    Signals describe the requested view; the server owns filtering, pagination, and permissions.

    See Advanced