Communication with server and client <nextjs>
i have a webhook which calls nextjs api, can that api call do something which triggers an action on
17 Replies
@nyx (Rustular DevRel)
hey, could you help me understand the flow?
are you using vercel?
yes
then no
you will need pooling
ohh
or use a external service for sockets
so the platform's webhook will call the api of nextjs, and not sure after that
the base line is the following

WS can be pusher or socketi, as a example
do nextjs has websocket ?
vercel runs on lambdas/workerd
so no websockets from nextjs without running on a server 100%
pusher is the easiest thing
GitHub
GitHub - pusher/docs: The all new Pusher docs, powered by @11ty and...
The all new Pusher docs, powered by @11ty and @vercel - pusher/docs
yeah
understood
Thanks
np
if this webhook happens as a consequence of a client side action, you could do polling i.e. make a request to the backend every N seconds to check for your api action
here's an in-depth explanation of the polling approach https://youtu.be/ZPh2Hapjd64?si=pAKZhQnA8e2_ZYm1
Web Dev Cody
YouTube
This is why you'll need polling in your web applications
give Hosna a follow: https://www.youtube.com/@hqasmei
--- my courses ---
📘 T3 Stack Tutorial: https://1017897100294.gumroad.com/l/jipjfm
--- my products ---
📖 ProjectPlannerAI: https://projectplannerai.com
🤖 IconGeneratorAI: https://icongeneratorai.com/
--- useful links ---
💬 Discord: https://discord.gg/4kGbBaa
🔔 Newsletter: https://newslette...