@rsc-kit/mcp 0.27.1 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/recipes.js +86 -16
- package/dist/recipes.js.map +1 -1
- package/guides/deployment.md +2 -2
- package/guides/go.md +1 -1
- package/guides/index.json +5 -0
- package/guides/laravel.md +25 -13
- package/guides/live-data.md +738 -0
- package/guides/sections.md +4 -460
- package/guides/where-it-runs.md +8 -0
- package/package.json +1 -1
package/guides/deployment.md
CHANGED
|
@@ -162,7 +162,7 @@ stacks on top of it.
|
|
|
162
162
|
|
|
163
163
|
## Streams and idle timeouts
|
|
164
164
|
|
|
165
|
-
An `events()` route and the [`refreshOn`](/guides/
|
|
165
|
+
An `events()` route and the [`refreshOn`](/guides/live-data)
|
|
166
166
|
stream hold a connection open and are quiet most of the time. Anything in
|
|
167
167
|
front that closes a quiet connection - the server's idle timeout, a proxy's
|
|
168
168
|
read timeout - would cut them, so each sends a keepalive line every **eight
|
|
@@ -189,7 +189,7 @@ one as another, so one leaking does not hand out the rest.
|
|
|
189
189
|
| Variable | What it protects | Who needs it | Read by |
|
|
190
190
|
| --- | --- | --- | --- |
|
|
191
191
|
| `RSC_HOST_CALL_SECRET` | calls between the renderer and a Go or Laravel backend | an app with a backend - required | the renderer **and** the backend |
|
|
192
|
-
| `RSC_SIGNING_SECRET` | the names a page hands a tab for [`refreshOn`](/guides/
|
|
192
|
+
| `RSC_SIGNING_SECRET` | the names a page hands a tab for [`refreshOn`](/guides/live-data) | an app that uses `refreshOn` - required in production | the renderer |
|
|
193
193
|
| `RSC_ACTION_ENCRYPTION_KEY` | values a server action sends through the browser, [across a deploy](#server-actions-across-a-deploy) | optional | the renderer, from the build |
|
|
194
194
|
|
|
195
195
|
`bun create rsc-kit` and `rsc-kit init` generate the first two into `.env` for
|
package/guides/go.md
CHANGED
|
@@ -286,7 +286,7 @@ reg.Names(&rsckit.SQLTags{DB: db, Placeholder: rsckit.Dollar}) // Postgres; ni
|
|
|
286
286
|
|
|
287
287
|
Anything with a `Bump` and a `Versions` fits. Set `RSC_SIGNING_SECRET` for the renderer, the same on every instance:
|
|
288
288
|
it signs the names a page hands the tab, and is not the host-call secret.
|
|
289
|
-
Generating and rotating both: [Secrets](/hosts/deployment#secrets). [Sections](/guides/
|
|
289
|
+
Generating and rotating both: [Secrets](/hosts/deployment#secrets). [Sections](/guides/live-data)
|
|
290
290
|
has the whole picture.
|
|
291
291
|
|
|
292
292
|
## Production
|
package/guides/index.json
CHANGED
|
@@ -124,6 +124,11 @@
|
|
|
124
124
|
"title": "Laravel",
|
|
125
125
|
"description": "React Server Components in front, a Laravel application behind them."
|
|
126
126
|
},
|
|
127
|
+
{
|
|
128
|
+
"slug": "live-data",
|
|
129
|
+
"title": "Live data",
|
|
130
|
+
"description": "Keep what a page shows current as the data changes - refreshOn, events, polling."
|
|
131
|
+
},
|
|
127
132
|
{
|
|
128
133
|
"slug": "mcp",
|
|
129
134
|
"title": "Working with an AI agent",
|
package/guides/laravel.md
CHANGED
|
@@ -358,28 +358,40 @@ later. Set `RSC_SIGNING_SECRET` for the renderer, the same on every instance:
|
|
|
358
358
|
it signs the names a page hands the tab, and is not the host-call secret.
|
|
359
359
|
Generating and rotating both: [Secrets](/hosts/deployment#secrets).
|
|
360
360
|
|
|
361
|
-
**
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
**What watching costs PHP.** The renderer asks Laravel which versions moved
|
|
362
|
+
once for every tab it serves, not once per tab: one request about every two
|
|
363
|
+
seconds per renderer process while any tab is watching, each a cache read.
|
|
364
|
+
Three renderers are one or two small requests a second for the whole fleet.
|
|
365
|
+
That is the default and the recommendation - Laravel stays the only thing
|
|
366
|
+
that talks to its database.
|
|
367
|
+
|
|
368
|
+
**Keeping versions in a table** (`RSC_VERSIONS=database`) is for when you
|
|
369
|
+
want them in the database rather than the cache: pruned on a schedule with
|
|
370
|
+
`rsc:prune-versions`, or written by something outside Laravel - a Go service,
|
|
371
|
+
a worker in another language - through the [shared table](/guides/live-data#the-table).
|
|
372
|
+
Laravel still answers the renderer from it; nothing else changes.
|
|
364
373
|
|
|
365
374
|
```sh
|
|
366
375
|
php artisan vendor:publish --tag=rsc-migrations && php artisan migrate
|
|
367
376
|
RSC_VERSIONS=database
|
|
368
377
|
```
|
|
369
378
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
379
|
+
**Instant, with broadcasting.** If the app has Laravel's broadcasting set up
|
|
380
|
+
(`php artisan install:broadcasting`) with a server that speaks the Pusher
|
|
381
|
+
protocol - Reverb, Pusher, Soketi - each `Rsc::changed()` can announce itself,
|
|
382
|
+
and the renderer asks the moment it hears:
|
|
373
383
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
384
|
+
```sh
|
|
385
|
+
RSC_BROADCAST=true # Laravel: announce every change
|
|
386
|
+
RSC_BROADCAST_URL=wss://ws.example.com # the renderer: where to listen
|
|
387
|
+
RSC_BROADCAST_KEY=your-app-key # the renderer: the server's app key
|
|
377
388
|
```
|
|
378
389
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
the
|
|
382
|
-
|
|
390
|
+
A change then reaches the tabs at once, and between changes the renderer asks
|
|
391
|
+
only every thirty seconds, as a safety net. The announcement carries nothing -
|
|
392
|
+
the channel is public, and names may be one visitor's - so Laravel still
|
|
393
|
+
answers which names moved, and the renderer never touches the database. It is
|
|
394
|
+
sent after the transaction commits.
|
|
383
395
|
|
|
384
396
|
## Route middleware
|
|
385
397
|
|