dreamstack/examples/streaming-counter.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

26 lines
620 B
Text

-- DreamStack Streaming Counter
-- A reactive counter that streams all signal changes
-- to remote receivers via the bitstream relay.
--
-- Run with:
-- cargo run -p ds-stream &
-- dreamstack stream examples/streaming-counter.ds
let count = 0
let doubled = count * 2
let message = "Streaming Counter"
stream counter on "ws://localhost:9100/peer/counter" { mode: signal, output: count, doubled }
view counter =
column [
text message
text count
text doubled
row [
button "-" { click: count -= 1 }
button "+" { click: count += 1 }
]
when count > 10 ->
text "On fire!"
]