File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/**
22 * This is the client-side code that uses the inferred types from the server
33 */
4- import { createTRPCClient , unstable_httpBatchStreamLink } from '@trpc/client' ;
4+ import {
5+ createTRPCClient ,
6+ splitLink ,
7+ unstable_httpBatchStreamLink ,
8+ unstable_httpSubscriptionLink ,
9+ } from '@trpc/client' ;
510/**
611 * We only import the `AppRouter` type from the server - this is not available at runtime
712 */
@@ -10,8 +15,14 @@ import type { AppRouter } from '../server/index.js';
1015// Initialize the tRPC client
1116const trpc = createTRPCClient < AppRouter > ( {
1217 links : [
13- unstable_httpBatchStreamLink ( {
14- url : 'http://localhost:3000' ,
18+ splitLink ( {
19+ condition : ( op ) => op . type === 'subscription' ,
20+ true : unstable_httpSubscriptionLink ( {
21+ url : 'http://localhost:3000' ,
22+ } ) ,
23+ false : unstable_httpBatchStreamLink ( {
24+ url : 'http://localhost:3000' ,
25+ } ) ,
1526 } ) ,
1627 ] ,
1728} ) ;
Original file line number Diff line number Diff line change 22 * This a minimal tRPC server
33 */
44import { createHTTPServer } from '@trpc/server/adapters/standalone' ;
5+ import { observable } from '@trpc/server/observable' ;
56import { z } from 'zod' ;
67import { db } from './db.js' ;
78import { publicProcedure , router } from './trpc.js' ;
Original file line number Diff line number Diff line change @@ -4,11 +4,7 @@ import { initTRPC } from '@trpc/server';
44 * Initialization of tRPC backend
55 * Should be done only once per backend!
66 */
7- const t = initTRPC . create ( {
8- experimental : {
9- iterablesAndDeferreds : true ,
10- } ,
11- } ) ;
7+ const t = initTRPC . create ( ) ;
128
139/**
1410 * Export reusable router and procedure helpers
You can’t perform that action at this time.
0 commit comments