Next.js Discord

Discord Forum

instant updates from route handler to frontend

Unanswered
Elite posted this in #help-forum
Open in Discord
So I have a webhook server that lets me know when a PayPal invoice has been paid.

And I have a dynamic route (/transaction/{id})

I want to immediately change my frontend when this invoice gets paid on the correlating id.

Rn I have a use state that checks for transaction status changes in mongodb.

So since the webhook runs on a route handler, I’m able to update the transactions state in mongodb, but Im not able to let the frontend use effect know that it’s been updating.

I don’t really want to poll as I want this flow to be as instant as possible, the user pays invoice in PayPal, frontend changes.

How could I do this?

0 Replies