@@ -20,8 +20,9 @@ node runtime.mjs
2020# also http://localhost:9001/capability/subscribe/<name> (SSE)
2121```
2222
23- ` runtime.mjs ` exposes a tiny ` /add_two_ints ` service + 1 Hz
24- ` /web_demo_tick ` publisher so every panel has live data.
23+ ` runtime.mjs ` exposes a tiny ` /add_two_ints ` service and the shared
24+ ` /web_demo_chatter ` talker/listener topic (publish from one panel,
25+ receive in the others).
2526
2627** Shell 2 — static-file server (hosts ` index.html ` + maps ` /sdk/* ` to
2728the in-repo [ ` web/ ` ] ( ../../../web/ ) folder so the page can ` import `
@@ -46,7 +47,7 @@ Open <http://localhost:8080/> in any modern browser. Runtime in shell
4647 const reply = await ros .call (' /add_two_ints' , { a: ' 2n' , b: ' 40n' });
4748 console .log (reply .sum ); // '42n'
4849
49- await ros .subscribe (' /web_demo_tick ' , (msg ) => render (msg .data ));
50+ await ros .subscribe (' /web_demo_chatter ' , (msg ) => render (msg .data ));
5051 await ros .publish (' /web_demo_chatter' , { data: ' hi' });
5152 </script >
5253```
@@ -71,12 +72,12 @@ so `subscribe` is reachable over HTTP as a `text/event-stream` — useful for
7172clients that can't hold a WebSocket open:
7273
7374``` bash
74- curl -N http://localhost:9001/capability/subscribe/web_demo_tick
75+ curl -N http://localhost:9001/capability/subscribe/web_demo_chatter
7576# event: ready
76- # data: {"capability":"/web_demo_tick ","subId":"sse"}
77+ # data: {"capability":"/web_demo_chatter ","subId":"sse"}
7778#
7879# event: message
79- # data: {"data":"tick 0 @ 2026-06-12T… "}
80+ # data: {"data":"hi from curl "}
8081# …one `message` event per published sample, until you ^C
8182```
8283
@@ -85,7 +86,7 @@ Browser apps should still prefer the WebSocket transport for `subscribe`
8586curl / AI-agent / server-side persona.
8687
8788The page also has a ** native ` EventSource ` panel** (section 6) that
88- subscribes to ` /web_demo_tick ` over the same SSE endpoint — no SDK, no
89+ subscribes to ` /web_demo_chatter ` over the same SSE endpoint — no SDK, no
8990WebSocket, just the browser primitive over plain HTTP. Because the page
9091(` :8080 ` ) and the HTTP transport (` :9001 ` ) are different origins, the
9192demo's ` runtime.mjs ` enables CORS (`new HttpTransport({ sse: true, cors:
@@ -94,10 +95,10 @@ pass your site's origin instead of `true`.
9495
9596### Pair it with the stock publisher example
9697
97- The EventSource panel's topic box defaults to ` /web_demo_tick ` , but the
98- runtime also exposes ` /topic ` so you can feed the demo from your own
99- node instead of the built-in tick loop . In a third shell, run the
100- standard publisher example:
98+ The EventSource panel's topic box defaults to ` /web_demo_chatter ` ( the
99+ shared demo topic), but the runtime also exposes ` /topic ` so you can
100+ feed the demo from your own node . In a third shell, run the standard
101+ publisher example:
101102
102103``` bash
103104source /opt/ros/< distro> /setup.bash
@@ -124,12 +125,11 @@ web runtime against your own publishers.
124125## Without the bundled ` runtime.mjs `
125126
126127` runtime.mjs ` bundles the rclnodejs/web runtime and the demo's sample
127- ROS 2 nodes (the ` /add_two_ints ` service + the ` /web_demo_tick `
128- publisher) into one process so the demo runs out of the box. In a
129- real project you already have those ROS 2 nodes running elsewhere,
130- so you only need the runtime. ** Replace shell 1's ` node runtime.mjs `
131- with the CLI** — shell 2 (` node static.mjs ` ) and the browser code are
132- unchanged:
128+ ROS 2 nodes (the ` /add_two_ints ` service) into one process so the demo
129+ runs out of the box. In a real project you already have those ROS 2
130+ nodes running elsewhere, so you only need the runtime. ** Replace shell
131+ 1's ` node runtime.mjs ` with the CLI** — shell 2 (` node static.mjs ` ) and
132+ the browser code are unchanged:
133133
134134``` bash
135135# shell 1 (instead of `node runtime.mjs`); the `-p rclnodejs` tells npx
@@ -138,7 +138,7 @@ npx -p rclnodejs rclnodejs-web web.json
138138
139139# the publisher / service the demo expects:
140140ros2 run demo_nodes_cpp add_two_ints_server
141- # (and a publisher of std_msgs/String on /web_demo_tick from any source)
141+ # (and a publisher of std_msgs/String on /web_demo_chatter from any source)
142142```
143143
144144> Note: this demo enables the SSE subscribe endpoint programmatically in
0 commit comments