@trpc/client 11.35.2 → 11.36.0
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/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@trpc/client",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "11.
|
|
5
|
+
"version": "11.36.0",
|
|
6
6
|
"description": "The tRPC client library",
|
|
7
7
|
"author": "KATT",
|
|
8
8
|
"license": "MIT",
|
|
@@ -100,12 +100,12 @@
|
|
|
100
100
|
"skills"
|
|
101
101
|
],
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@trpc/server": "11.
|
|
103
|
+
"@trpc/server": "11.36.0",
|
|
104
104
|
"typescript": ">=5.7.2"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@tanstack/intent": "0.5.6",
|
|
108
|
-
"@trpc/server": "11.
|
|
108
|
+
"@trpc/server": "11.36.0",
|
|
109
109
|
"@types/isomorphic-fetch": "^0.0.39",
|
|
110
110
|
"@types/node": "^24.19.2",
|
|
111
111
|
"dataloader": "^2.2.3",
|
package/skills/links/SKILL.md
CHANGED
|
@@ -372,6 +372,25 @@ type HTTPSubscriptionLinkOptions<
|
|
|
372
372
|
|
|
373
373
|
## SSE Options on the server
|
|
374
374
|
|
|
375
|
+
Pass an object to `initTRPC.create({ sse })` to use the same options for every subscription, or pass a function to choose options when a subscription connects. The function receives the dotted procedure `path`, the request context (`ctx`), and the procedure's [metadata](https://trpc.io/docs/server/metadata) (`meta`). Return `undefined` to use the defaults. If the function throws, the server uses the default connection settings and streams the error to the client.
|
|
376
|
+
|
|
377
|
+
```ts no-check title="server/trpc.ts"
|
|
378
|
+
import { initTRPC } from '@trpc/server';
|
|
379
|
+
|
|
380
|
+
const t = initTRPC.meta<{ live: boolean }>().create({
|
|
381
|
+
sse: ({ meta }) =>
|
|
382
|
+
meta?.live
|
|
383
|
+
? {
|
|
384
|
+
ping: { enabled: true, intervalMs: 5_000 },
|
|
385
|
+
client: { reconnectAfterInactivityMs: 20_000 },
|
|
386
|
+
}
|
|
387
|
+
: undefined,
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// Subscriptions built from this procedure use the shorter timers.
|
|
391
|
+
export const liveProcedure = t.procedure.meta({ live: true });
|
|
392
|
+
```
|
|
393
|
+
|
|
375
394
|
```ts no-check
|
|
376
395
|
export interface SSEStreamProducerOptions<TValue = unknown> {
|
|
377
396
|
ping?: {
|