dreamstack/examples/compose-dashboard.ds
enzotar 442a2db65e fix: use explicit /peer/counter channel for streaming-counter
The 'default' relay channel accumulated stale Source connections from
previous sessions, causing frame delivery issues to Receivers on
/stream/default. Moving counter to an explicit /peer/counter channel
(matching clock, stats, mood pattern) fixes the composition dashboard.

All 4 streams now show live data: Count: 3, Doubled: 6.
2026-02-26 09:45:07 -08:00

53 lines
1.7 KiB
Text

-- DreamStack 4-App Composition Dashboard
-- Composes signals from 4 independent streaming apps.
-- Each app has explicit output declarations:
-- counter: count, doubled (NOT message)
-- clock: hours, minutes, seconds (NOT tick)
-- stats: total, average, max (NOT sum, last_sample)
-- mood: mood, energy, color (NOT clicks)
--
-- Run with:
-- Tab 1: cargo run -p ds-stream
-- Tab 2: dreamstack stream examples/streaming-counter.ds --port 3000
-- Tab 3: dreamstack stream examples/streaming-clock.ds --port 3002
-- Tab 4: dreamstack stream examples/streaming-stats.ds --port 3003
-- Tab 5: dreamstack stream examples/streaming-mood.ds --port 3004
-- Tab 6: dreamstack build examples/compose-dashboard.ds
--
-- Open the built file in a browser.
let counter = stream from "ws://localhost:9100/stream/counter"
let clock = stream from "ws://localhost:9100/stream/clock"
let stats = stream from "ws://localhost:9100/stream/stats"
let mood = stream from "ws://localhost:9100/stream/mood"
view main =
column [
text "🎛️ DreamStack Signal Composition"
text "4 apps → 1 dashboard"
row [
column [
text "── 🔢 Counter ──"
text "Count: {counter.count}"
text "Doubled: {counter.doubled}"
]
column [
text "── 🕐 Clock ──"
text "{clock.hours}:{clock.minutes}:{clock.seconds}"
]
]
row [
column [
text "── 📊 Stats ──"
text "Samples: {stats.total}"
text "Average: {stats.average}"
text "Max: {stats.max}"
]
column [
text "── 😊 Mood ──"
text "Mood: {mood.mood}"
text "Energy: {mood.energy}%"
text "Color: {mood.color}"
]
]
]