title: Live Content page: live-content

Live Content

Fetch HTML from the server and inject it into the page without a full reload.

Basic Injection (Replace)

Click the button to fetch server-rendered content and replace the target area.

Server time will appear here...

Append Mode

Each click appends a new notification to the end of the list.

Notifications will be appended here...

Prepend Mode

New content is inserted at the beginning of the target, pushing older items down.

Items will be prepended here...

Session Counter

The counter is stored in the session and updates reactively through live injection.

Counter: #session.notification_count#

Add & Clear Notifications

Add notifications to the list, or clear them all at once. Both operations happen without leaving the page.

Content will appear here...

Real-Time Updates

WebSocket Channels

Subscribe to named channels with w-channel and receive server-pushed updates in real time.

Server-Sent Events

Lightweight one-way streaming with w-sse for live feeds, notifications, and dashboards.

How It Works

This page demonstrates live content injection without full page reloads. Each button uses w-get to fetch a partial template from the server, w-target to select the destination element, and w-swap to control insertion mode (replace, append, or prepend). Session state persists across requests, enabling counters and notification lists that survive interactions.