Skip to main content
The live template creates real-time applications with WebSocket support. Normal web pages only update when you refresh them. Real-time apps update automatically - like chat apps or live dashboards. WebSockets keep a connection open between your browser and the server, so the server can push updates to you instantly without you asking.

When to Use This Template

Use the live template when:
  • Real-time updates - Data changes pushed to clients instantly
  • Interactive UI - User actions trigger server-side updates
  • Live dashboards - Metrics, monitoring, feeds
  • Collaborative features - Chat, notifications, presence

What You Get

  • Live views - Server-rendered UI that updates automatically
  • WebSocket handling - Built-in connection management
  • Pub/sub messaging - Broadcast to all or specific clients
  • Session management - Track connected users

Quick Start

Open http://localhost:8080 to see a live counter example.

How It Works

1. User Loads Page

Server renders the initial HTML.

2. WebSocket Connects

JavaScript connects to /ws endpoint.

3. User Interacts

Click events send messages to server.

4. Server Updates

Server processes message, sends HTML back.

5. UI Updates

Client replaces DOM with new HTML.

Project Structure

Example: Counter

Key Features

Live Updates

Push HTML updates to connected clients:

Session State

Track per-connection state:

Topics

Subscribe to specific channels:

Next Steps

Project Structure

Understand every file

Tutorial

Build a real-time app