27 lines
648 B
Text
27 lines
648 B
Text
|
|
-- DreamStack WebRTC Streaming Counter
|
||
|
|
-- Same as streaming-counter.ds but uses peer-to-peer WebRTC
|
||
|
|
-- data channels for sub-frame latency, with WebSocket fallback.
|
||
|
|
--
|
||
|
|
-- Run with:
|
||
|
|
-- cargo run -p ds-stream &
|
||
|
|
-- dreamstack stream examples/streaming-webrtc.ds
|
||
|
|
|
||
|
|
let count = 0
|
||
|
|
let doubled = count * 2
|
||
|
|
let message = "WebRTC Counter"
|
||
|
|
|
||
|
|
stream counter on "ws://localhost:9100/source/webrtc-demo" { mode: signal, transport: webrtc }
|
||
|
|
|
||
|
|
view counter =
|
||
|
|
column [
|
||
|
|
text message
|
||
|
|
text count
|
||
|
|
text doubled
|
||
|
|
row [
|
||
|
|
button "-" { click: count -= 1 }
|
||
|
|
button "+" { click: count += 1 }
|
||
|
|
]
|
||
|
|
when count > 10 ->
|
||
|
|
text "On fire!"
|
||
|
|
]
|