@@ -29,16 +29,15 @@ SDK from a plain URL).
2929 const ros = await connect (' ws://localhost:9000/capability' );
3030
3131 const reply = await ros .call (' /add_two_ints' , { a: ' 2n' , b: ' 40n' });
32- console .log (reply .sum ); // '42n'
32+ console .log (reply .sum ); // '42n'
3333
3434 await ros .subscribe (' /web_demo_tick' , (msg ) => render (msg .data ));
3535 await ros .publish (' /web_demo_chatter' , { data: ' hi' });
3636 </script >
3737```
3838
39- That's the whole client. The page also has a ** transport toggle**
40- (WebSocket vs. HTTP) so you can flip the SDK between the two without
41- restarting.
39+ The page also has a ** transport toggle** (WebSocket vs. HTTP) so you
40+ can flip the SDK between the two without restarting.
4241
4342## Same capability, no SDK
4443
@@ -67,10 +66,10 @@ The browser code is unchanged; only the URL it points to changes.
6766
6867## Putting the SDK in your own project
6968
70- | Approach | When | How |
71- | ---| ---| ---|
72- | Plain ` <script type="module"> ` | static page, hackathon | host ` web/index.js ` somewhere, ` import { connect } from '/path/to/it' ` |
73- | ESM via npm | Vite, Next.js, esbuild, webpack | ` npm i rclnodejs ` , then ` import { connect } from 'rclnodejs/web' ` |
74- | ESM CDN | quick prototypes, codepens | ` import { connect } from 'https://esm.sh/rclnodejs/web' ` |
69+ | Approach | When | How |
70+ | ------------------------------- | ------------------------------- | ------------------------------------------------------------------ |
71+ | Plain ` <script type="module"> ` | static page, hackathon | host ` web/index.js ` somewhere, ` import { connect } from '/path/to/it' ` |
72+ | ESM via npm | Vite, Next.js, esbuild, webpack | ` npm i rclnodejs ` , then ` import { connect } from 'rclnodejs/web' ` |
73+ | ESM CDN | quick prototypes, codepens | ` import { connect } from 'https://esm.sh/rclnodejs/web' ` |
7574
7675For a typed version, see the [ TypeScript demo] ( ../typescript/ ) .
0 commit comments