WebSocket Disabled

This app recipe demonstrates LiveTemplate's WithWebSocketDisabled() mode. The client library is still included and handles all interactions — but uses HTTP fetch instead of WebSocket to send actions and receive tree-based DOM updates.

When to use this mode

How it works

The client library is still there

The page still loads the client library, and it behaves the same as in WebSocket mode:

Detection

The client detects WebSocket availability by checking the X-LiveTemplate-WebSocket response header:

Progressive enhancement

Forms use method="POST" with button name routing, so the app still works without JavaScript via the POST-Redirect-GET pattern.

Running

# Development mode (serves client library locally)
LVT_DEV_MODE=true go run .

Visit http://localhost:8080.

Files

source: livetemplate/docs · path: content/recipes/apps/ws-disabled.md