T3 for a chat app

Although I don't remember the exact video now. I remember Theo saying that the t3 stack would not be optimal for an application that constantly updates it's data. I assumed this meant something like a chat app that relies heavily on web sockets. If I am correct here, could someone help me understand why using t3 app is not optimal for this type of app? Also what should I use instead?
M
Matvey368d ago
i think this is the video you're talking about - https://youtu.be/-R9uHm0G5m4 T3 stack is expected to be deployed on a serverless environment. Serverless isn't designed for long connections, so you can't really use websockets You can still use T3 for a chat app. tRPC has subscriptions, and they are very useful for getting updates. Just deploy it with docker on a VPS
A
adnanjpg368d ago
Just deploy it with docker on a VPS wouldn't you be deploying all of your next.js app on your own this way? is there any disadvantages between this approach vs deploying on vercel?
N
Neto368d ago
vercel run on lambdas and you (kinda) can't use ws on lambdas
K
korgko368d ago
You can take a look at this example that uses soketi for sockets that might help you. https://github.com/pingdotgg/zapdos
GitHub
GitHub - pingdotgg/zapdos
Contribute to pingdotgg/zapdos development by creating an account on GitHub.
J
javiercervera367d ago
This Vercel article provides some solutions to the issue with websockets https://vercel.com/guides/publish-and-subscribe-to-realtime-data-on-vercel I am planning to use Supabase Realtime to subscribe the frontend/client to Supabase so that changes made to the database can be published back on the client
Vercel Documentation
How to Add Realtime Communication on Vercel Applications
Learn how to integrate realtime communication to your Vercel application using providers like Ably or Supabase.
M
MadaShindeInai366d ago
Hmm, looks like there are 2 ways: drop idea of building chat (build it as http / use 3-rd party embedded solution) or leave Vercel (welcome to the Docker world and getting lots of devops job) Hmm, maybe server-side events can be somehow used for this purposes? thinkies
Z
zsrobinson366d ago
Server sent events have the same problems that web sockets do in regards to deploying on serverless I believe Nextjs doesn't force you into deploying on serverless, so you could always just put it on some random VPS if you don't expect to be the next whatsapp
M
MadaShindeInai366d ago
Hmm, and what about building separate ws server in NodeJS, hosting it somewhere, and connecting to it from NextJS client (from component)? I really do not want to leave Vercel, as deploying create-t3-turbo somewhere is a f..ken hell
Z
zsrobinson366d ago
Yeah that seems like it could be a good way to go about it, that's pretty much what all those other web socket providers are doing
M
MadaShindeInai364d ago
Interesting thing is how to make that ws connection protected, as it is external app.
A
adnanjpg350d ago
supabase may be the best solution. I added real time post update to my simple app using postgres_changes (https://supabase.com/docs/guides/realtime/extensions/postgres-changes) https://github.com/adnanjpg/baykus/blob/main/src/hooks/useRealtimePostUpdates.ts for chat, the Broadcast method would probably be better https://supabase.com/docs/guides/realtime/extensions/broadcast
Postgres Changes | Supabase Docs
Getting started with Realtime's Postgres Changes feature
GitHub
baykus/useRealtimePostUpdates.ts at main · adnanjpg/baykus
Contribute to adnanjpg/baykus development by creating an account on GitHub.
Broadcast | Supabase Docs
Getting started with Realtime's Broadcast feature
Want results from more Discord servers?
Add your server
More Posts
How do I use a tRPC procedure outside a react componentHello guys, I made a simple router which will give me similar tags from my tags model from prisma `Syntax help for useQuery with no inputshi, i have two queries in my component, however on my first query I can't pass in refetchOnMount? anAlternative to Planetscale for multiple smaller appsHi While creating our latest tool, I used the tRPC + Planetscale + Clerk stack and fell in love witRemoving unused importsA rather annoying and controversial thing that was built into version 7.3.2. As far as I can see, tvariable initialized useState as true but the state is falsehasReaction is true, but liked is false error gets printed multiple times const hasReaction = poscreate-t3-turbo monorepo: How to access user session to packages/db?I would like to access some props from user's session to **prisma middleware** i.e. in below exampleCreating an update mutation with tRPCHi everyone, I'm trying to use an update mutation in this way: ```ts export const beerRouter = creatCreate and Download PDFI have a web app that allows users to edit a table including drag/dropping rows, change row colors, Is it possible to pass a zod schema as a prop?I have this ```ts interface Props { schema: ZodSchema; children: React.ReactNode; defaulLoading state of a `'use server'` componentIs it possible to have a loading state for e.g. a form submission using the new `use server` directiHow do you self host your projects in a vpswithout relying on any cpanel or vercel, i have a vps and i usually move the project using git and Geniune question: php vs server componentsI love nextjs. I hear a lot of comments about nextjs just reinvented php. Can someone clarify thingsHow do you fetch an svg from s3 into an angular app?I tried several things, but each time the svg isn't displayed.What's this errorit was working till yesterday then i added stateDistrict to address model then i started to get thisPrisma find many undefinedHello, In my other projet when i do `prisma.resource.findMany({select: ...})` the type is `{id: strESLint to force @types in dev-dependenciesWe recently had an outage coz someone installed the @types/[package-name] in dependencies, but neverUpdating existing T3 with Supabase Auth from Next AuthBackground: - Launched a T3 app with Next Auth. - Currently got 3000 users. - Launching an app vetRPC + AppRouter without reactQueryhi everyone how can i host trpc on next.js and use trpc on server components without using react queMutate instantly returning success instead of isLoadingI have been working on this endpoint that uploads files do Google Drive. It can upload one or multipNext 13.4 problem with loading state after content is visible & hydration problemHey, I have a small app with Next 13.4 with Shadcn Ui 😍 it's really really good. But I'm also using