kenny
TTCTheo's Typesafe Cult
•Created by kenny on 7/30/2024 in #questions
Websocket advice nextjs-nestjs
Hi everyone,
I'm currently working on a Point of Sale (POS) web app that is primarily used on Samsung tablets with a special browser called Star WebPRNT. This browser is required for receipt printing functionality.
Recently, I started developing a QR code scanning feature to scan vouchers and apply discounts for customers. The feature works perfectly on Chrome, but unfortunately, it doesn't work in the Star WebPRNT browser, which is quite frustrating.
To work around this, my team and I decided to move the QR code scanning feature to a separate page that will be accessed via Chrome (or any browser other than Star WebPRNT). When a QR code is scanned, it should notify the app running in the Star WebPRNT browser about the scanned voucher data. We plan to send this data via WebSockets and then set it in the React state.
Here's the setup we envision:
- Main POS app:
https://ourproject.vercel.app/
(running in the Star WebPRNT browser)
- QR code scanning page: https://ourproject.vercel.app/scan-voucher
(running in another browser, like Chrome)
Both pages will communicate with each other via WebSockets.
My question is: What WebSocket service would you recommend for this setup?
The company I work for doesn't want to use AWS, even though we have used it in the past. So, I'm looking for alternatives.
Additional context:
- The app is built with Next.js and communicates with a NestJS backend.
Any advice or recommendations would be greatly appreciated! Thank you.2 replies
TTCTheo's Typesafe Cult
•Created by kenny on 5/17/2023 in #questions
Type error when using useInfiniteQuery
That's the type error I am getting.
I am using trpc with nextjs
This is the query I am making:
This is how it's handled on the trpc router:
18 replies
TTCTheo's Typesafe Cult
•Created by kenny on 5/8/2023 in #questions
Error: No QueryClient set, use QueryClientProvider to set one
The error is coming from this snippet
Where I try to fetch products by page.
the products routers look as follows:
And Inside of my
_app.tsx
component I am returning this:
So I have indeed set QueryClientProvider and passed the QueryClient
through.29 replies
TTCTheo's Typesafe Cult
•Created by kenny on 4/29/2023 in #questions
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.86 replies
TTCTheo's Typesafe Cult
•Created by kenny on 4/19/2023 in #questions
How to SSG a page from my T3 app??
I have been following this documentation:
https://trpc.io/docs/nextjs/ssg
So I have a
[chat].tsx
route and I put this in the page component:
But, ctx is giving me ts errors.
And when I do ctx: {}
I get this
Not sure why this error is not addressed in the docs.78 replies
TTCTheo's Typesafe Cult
•Created by kenny on 4/17/2023 in #questions
Next-Auth: Try signing in with a different account.
So this error I am getting in the browser This is very common. It usually doesn't tell me what's wrong.
The first thing I do when I see this is check my environment variables. Checking if theyre correct. Which they are.
I am using
create-t3-app
So it also checks that for me by default.
I am added a Google Provider and when I click on sign in with google, It doesn't redirect me to the correct page. It instead brings me to the /api/auth/signin
page with an error message.
This is also happening, it redirects me to api/auth/signin?error=OAuthAccountNotLinked
And I see this error
Any idea what's going on?10 replies
TTCTheo's Typesafe Cult
•Created by kenny on 4/10/2023 in #questions
T3 app takes up too much RAM
when I start my app with
npm run dev
acces the nextjs app via localhost, and check the task manager, the windows powershell already takes up 300MB of RAM. I sign in using Discord provider, It takes up More! After that the just becomes unresponsive. And the terminal just goes crazyy. I could hop on a call and share my screen to show what I mean.166 replies