Skip to content

plotly/dash-ws-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dash WebSocket Demo

A collection of demos showcasing Dash's persistent WebSocket callbacks for real-time data updates.

Demos

IoT Sensor Dashboard (demo-iot)

Real-time monitoring of 4 simulated sensors (temperature, humidity, light, pressure) with random walk simulation and dual-axis charts updating at ~10Hz.

IoT Dashboard Demo

Nuclear Reactor Simulator (demo-nuclear)

RBMK-1000 style control room interface with core temperature heatmap, control rod positions, and multiple metrics updating at different rates (20Hz, 2Hz, 0.5Hz).

Nuclear Reactor Demo

Game of Life (demo-game-of-life)

Interactive Conway's Game of Life on a 50x50 grid with adjustable speed, start/stop controls, and generation tracking.

Game of Life Demo

Drum Machine (demo-drums)

Interactive 16-step × 8-instrument beat sequencer with click-to-toggle beats, adjustable BPM, and real-time playhead animation.

Particle Sandbox (demo-particles)

Real-time physics simulation with click-to-spawn particles, adjustable gravity/friction/bounce, and attractor/repulsor particle types.

Requirements

  • Python 3.13
  • uv package manager
  • Local editable install of Dash with persistent callback support

Setup

uv sync

Or using just:

just setup

Running Demos

Using just:

just iot        # IoT sensor dashboard
just nuclear    # Nuclear reactor simulator
just gol        # Game of Life
just drums      # Drum machine
just particles  # Particle sandbox

Or directly:

uv run demo-iot
uv run demo-nuclear
uv run demo-gol
uv run demo-drums
uv run demo-particles

Project Structure

dash-ws-demo/
├── packages/
│   ├── demo-iot/           # IoT sensor dashboard
│   ├── demo-nuclear/       # Nuclear reactor simulator
│   ├── demo-game-of-life/  # Conway's Game of Life
│   ├── demo-drums/         # Drum machine
│   └── demo-particles/     # Particle sandbox
├── pyproject.toml          # UV workspace config
├── uv.lock                 # Dependency lock file
└── justfile                # Task automation

Key Features Demonstrated

  • Persistent WebSocket Callbacks: @callback(persistent=True) for continuous server-to-client updates
  • Async Operations: Non-blocking updates using async/await with asyncio.sleep()
  • Targeted Updates: set_props() for efficient component updates without full re-renders
  • Multiple Update Rates: Different components updating at independent frequencies

About

Demo Plotly Dash apps using websocket callbacks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages