title: State page: state

State Management

Server-side state management with application-wide and per-session counters, plus reactive session variables.

Application Counter

This counter is shared across all users. Every visitor sees and increments the same value. Use w-set to mutate application state declaratively from HTML.

#data.application.app_counter#
<button w-set="app.app_counter += 1">+1</button>

Application data persists across all sessions and is stored server-side. Atomic read-modify-write prevents race conditions under concurrent access.

Wired Counter (Real-time)

This counter updates in real time across all connected browsers via WebSocket. Open this page in two tabs or two browsers and watch them stay in sync.

#wired.wired_counter#
<button w-set="wired.wired_counter += 1">+1</button>
<span>#wired.wired_counter#</span>

Wired state is like application state, but pushes updates to every connected client instantly. No WebSocket code needed — just use wired.* in your w-set attribute.

Session Counter

This counter is unique to your session. Other users have their own separate counter.

#session.counter#
<button w-set="session.counter += 1">+1</button>

Session data is tied to your browser session and resets when the session expires.

Session Variables

Template variables like #session.*# provide direct access to session state. These are automatically wrapped with reactive bindings for live updates.

Session Counter Value
#session.counter#
Session ID
#session.id#

Session variables update reactively when their values change on the server.

Clear Session Data

Reset all session-specific data, including counters and any stored session variables.