tRPC websockets, getting Typescript error on apply WSSHandler with createTRPCContext

Hey everyone! I am trying to use tRPC subscriptions and from my understanding, that means I need to us websockets rather than the standard HTTP links that ship with t3 stack.
I have an app created using ct3a, and I'm trying to incorporate the implementation described here: https://github.com/trpc/examples-next-prisma-websockets-starter But, I am getting a Typescript error when I attempt to use createTRPCContext in the applyWSSHandler. Would appreciate guidance! I am deploying to my own server. TypeScript error: Argument of type '{ wss: ws.Server<typeof ws, typeof IncomingMessage>; router: CreateRouterInner<RootConfig<{ ctx: { session: Session | null; prisma: PrismaClient<Prisma.PrismaClientOptions, never, Prisma.RejectOnNotFound | Prisma.RejectPerOperation | undefined>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }...' is not assignable to parameter of type 'WSSHandlerOptions<CreateRouterInner<RootConfig<{ ctx: { session: Session | null; prisma: PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation | undefined>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>>'. Object literal may only specify known properties, but 'createTRPCContext' does not exist in type 'WSSHandlerOptions<CreateRouterInner<RootConfig<{ ctx: { session: Session | null; prisma: PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation | undefined>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>>'. Did you mean to write 'createContext'?ts(2345)
GitHub
GitHub - trpc/examples-next-prisma-websockets-starter: 🏓 tRPC Next....
🏓 tRPC Next.js WebSocket Starter. Contribute to trpc/examples-next-prisma-websockets-starter development by creating an account on GitHub.
No description
2 Replies
darthreza
darthreza15mo ago
Any ideas on how to implement websockets in a T3 compliant way guys? I'd like to be able to use all the TRPC and NextAuth bells and whistles Following-up
OtterSwims996
OtterSwims99610mo ago
i'm having the same issue as well, i found an example repo but i'm not sure how to get it working with the existing t3 stack: https://github.com/trpc/examples-next-prisma-websockets-starter/blob/main/src/server/routers/post.ts
GitHub
examples-next-prisma-websockets-starter/src/server/routers/post.ts ...
🏓 tRPC Next.js WebSocket Starter. Contribute to trpc/examples-next-prisma-websockets-starter development by creating an account on GitHub.
Want results from more Discord servers?
Add your server