Elite
Elite
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
Hm ok
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
300 seconds is enough right. 2 min max per transaction.
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
we have pro tier. so 300 seconds
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
kinda
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
Can I not do streaming or smth like that.
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
Hm ok thanks
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
or any better way to optimize
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
so with the flow i sent above, is my appraoch right? checking every 5 seconds for 2 min?
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
no so we actually invoice them automtically with the paypal api when the form is submitted
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
so basically i can't make my backend send a request to my frontend. the frontend needs to check continuously
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
wdym? the flow is: user submits the form, we auto invoice their paypal. then we set a 2 min timer for the user to pay the invoice. if user pays, paypal sends us a webhook. we then update a db field. frontend continually checks updated field value in mongodb every 5 sec. if the user does not pay, (2 min goes past), and no paypal webhook sent, then we cancel the invoice and update state to show an error on frontend
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
ye well it would depend on how fast the user pays the invoice. so ill probs set a max of 2 min, and then stop checking and cancel the transaction
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
So rn, when the user submits the form we auto invoice them based on the details they put. Then when the invoice is paid PayPal sends a webhook. There I would update that transaction in my db, and on the frontend I constantly check with a timer for any changes of that value right
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
ye i am, so it isnt possible for my backend endpoint to send some data over to the frontend to update
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
at scale can that kill my vercel limits? im on the pro plan rn but yk just in case.
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
So should I do normal polling? Or how is it gonna work. Can I not like ping my frotnned state when I get smth from the webhook on the backend
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
hey @Ian sorry for the ping. just wondering ^^
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
so if im doing long poll, the code abovie is in a route handler (the paypal invoice paid one). what would i do to long poll
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
and then on my frontnend how could i make like all the stauts changes seamless and instant? rn i just hjave a useeffect for every time the status state changes, the ui gets updated
54 replies
TTCTheo's Typesafe Cult
Created by Elite on 6/24/2024 in #questions
instant updates from route handler to frontend
so rn when a paypal invocie is paid, i get the event, verify it, update in mongodb, and then i need to let the poll know:
if (updateStatus) {
// todo: add long polling notify here
return NextResponse.json({ status: "success" });
} else {
return NextResponse.json({ error: "Failed to update transaction status" }, { status: 500 });
}
if (updateStatus) {
// todo: add long polling notify here
return NextResponse.json({ status: "success" });
} else {
return NextResponse.json({ error: "Failed to update transaction status" }, { status: 500 });
}
54 replies