Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
85 replies
kenny

next-prisma-websockets-starter explanation

This is the repo I'm trying to copy websocket setup from... https://github.com/trpc/examples-next-prisma-websockets-starter

Inside of the server folder in this template, [https://github.com/trpc/examples-next-prisma-websockets-starter/tree/main/src/server] there is a prodServer.ts file and a wssDevServer.ts file. How are these files used?? When and how is the prodServer.ts file used(ran) and how is the wssDevServer.ts file ran?

Because in the
trpc.ts
file [https://github.com/trpc/examples-next-prisma-websockets-starter/blob/main/src/utils/trpc.ts] the wsLink is used but there are no checks for dev or prod. And WS_URL is imported from publicRuntimeConfig. This is confusing.

The tRPC docs also do it differently. They hardcode the websocket urls. And there are no checks for dev and prod.
GitHub
🏓 tRPC Next.js WebSocket Starter. Contribute to trpc/examples-next-prisma-websockets-starter development by creating an account on GitHub.
GitHub - trpc/examples-next-prisma-websockets-starter: 🏓 tRPC Next....
Was this page helpful?