diff --git a/examples/batch-pipelining/server-node.mjs b/examples/batch-pipelining/server-node.mjs index 10ab4e6..1e9857e 100644 --- a/examples/batch-pipelining/server-node.mjs +++ b/examples/batch-pipelining/server-node.mjs @@ -23,7 +23,7 @@ const PROFILES = new Map([ ]); const NOTIFICATIONS = new Map([ - ['u_1', ['Welcome to jsrpc!', 'You have 2 new followers']], + ['u_1', ['Welcome to Cap\'n Web!', 'You have 2 new followers']], ['u_2', ['New feature: pipelining!', 'Security tips for your account']], ]); diff --git a/examples/worker-react/README.md b/examples/worker-react/README.md index 2e47f90..3a6c41d 100644 --- a/examples/worker-react/README.md +++ b/examples/worker-react/README.md @@ -1,6 +1,6 @@ Cloudflare Workers + React Example -This example shows a Cloudflare Worker exposing a JSRPC API and a React app calling it from the browser. It demonstrates batching + promise pipelining vs sequential requests, with timing and request counts. +This example shows a Cloudflare Worker exposing a Cap'n Web API and a React app calling it from the browser. It demonstrates batching + promise pipelining vs sequential requests, with timing and request counts. Prerequisites @@ -21,7 +21,7 @@ Run locally 1) Build the library at repo root (the example uses the local dist build): npm run build -2) Install and build the React app (Vite aliases `@cloudflare/jsrpc` to the local `dist`): +2) Install and build the React app (Vite aliases `capnweb` to the local `dist`): cd examples/worker-react/web npm install npm run build @@ -40,8 +40,4 @@ Tuning delays - `DELAY_PROFILE_MS` (default 120) - `DELAY_NOTIFS_MS` (default 120) - `SIMULATED_RTT_MS` per direction (default 120) - - `SIMULATED_RTT_JITTER_MS` per direction (default 40) - -Notes - -- The frontend imports `@cloudflare/jsrpc`. If trying this example before publish, you can `npm link` the built package into the `web` app or adjust imports to point at a local path. + - `SIMULATED_RTT_JITTER_MS` per direction (default 40) \ No newline at end of file diff --git a/examples/worker-react/src/worker.ts b/examples/worker-react/src/worker.ts index afee9ff..7e89ab1 100644 --- a/examples/worker-react/src/worker.ts +++ b/examples/worker-react/src/worker.ts @@ -1,5 +1,4 @@ -// Use local build output so this example runs without publishing to npm. -import { newWorkersRpcResponse, RpcTarget } from '../../../dist/index.js'; +import { newWorkersRpcResponse, RpcTarget } from 'capnweb'; type Env = { DELAY_AUTH_MS?: string; @@ -23,11 +22,11 @@ const PROFILES = new Map([ ]); const NOTIFICATIONS = new Map([ - ['u_1', ['Welcome to jsrpc!', 'You have 2 new followers']], + ['u_1', ['Welcome to Cap\'n Web!', 'You have 2 new followers']], ['u_2', ['New feature: pipelining!', 'Security tips for your account']], ]); -class Api extends RpcTarget { +export class Api extends RpcTarget { constructor(private env: Env) { super(); } async authenticate(sessionToken: string) { diff --git a/examples/worker-react/web/index.html b/examples/worker-react/web/index.html index 9212994..040235e 100644 --- a/examples/worker-react/web/index.html +++ b/examples/worker-react/web/index.html @@ -3,7 +3,7 @@
-This demo calls the Worker API in two ways: