WS
Unanswered
Tan posted this in #help-forum
TanOP
Hi, i know that nextjs is serverless. But, is here some magic way, to use WS in next? I need to add chat to the existing next app... it is the reason, why i am asking for this stupid question. Thank you.
2 Replies
Double-striped Thick-knee
websockets aren't supported in serverless environments because serverless functions are short-lived by design. WebSocket requires long-lived connection to maintain communication. Since serverless functions spin up and shut down with each request, they can't keep the WebSocket connection alive. you should set up a dedicated server
Next.js itself isn't serverless; it supports both serverless and traditional server environments.