Problem with the WebSockets
Hi Guys Iam trying to make a Simple chat website and when iam trying to do so i faced a error at createContext ,
Can Somoeone Please Tell me WHat is Wrong ?
3 Replies
What does your createContext look like?
I assume you followed this guide: https://trpc.io/docs/subscriptions
Subscriptions / WebSockets | tRPC
Using Subscriptions
Here is an example of how the createContext should look like: https://github.com/trpc/examples-next-prisma-websockets-starter/blob/main/src/server/context.ts
GitHub
examples-next-prisma-websockets-starter/src/server/context.ts at ma...
🏓 tRPC Next.js WebSocket Starter. Contribute to trpc/examples-next-prisma-websockets-starter development by creating an account on GitHub.
Yeah I did checkout the repo , I figured out that it's for old version but for newer version it's not working , I did use this at createTRPCcontext but no use , opts:
| NodeHTTPCreateContextFnOptions<IncomingMessage, WebSocket>
| trpcNext.CreateNextContextOptions,
Update : - it's working i forgot to import import { WebSocket } from 'ws';