@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.35.2",
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.35.2",
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.35.2",
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",
@@ -12,7 +12,7 @@ sources:
12
12
  metadata:
13
13
  type: core
14
14
  library: trpc
15
- library_version: 11.35.2
15
+ library_version: 11.36.0
16
16
  ---
17
17
 
18
18
  <!-- Generated from www/v11/docs/client/vanilla/setup.md by www/build/skills.ts. Edit the docs instead. -->
@@ -17,7 +17,7 @@ sources:
17
17
  metadata:
18
18
  type: core
19
19
  library: trpc
20
- library_version: 11.35.2
20
+ library_version: 11.36.0
21
21
  ---
22
22
 
23
23
  <!-- Generated from www/v11/docs/client/links.md by www/build/skills.ts. Edit the docs instead. -->
@@ -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?: {
@@ -9,7 +9,7 @@ sources:
9
9
  metadata:
10
10
  type: composition
11
11
  library: trpc
12
- library_version: 11.35.2
12
+ library_version: 11.36.0
13
13
  ---
14
14
 
15
15
  <!-- Generated from www/v11/docs/server/data-transformers.md by www/build/skills.ts. Edit the docs instead. -->