Socket-io Server written in Express.js deployed on Vercel is not connected to frontend

I have created a express.js server in which i use socket-io for handling real time notification and then i deployed it in vercel and check it on next-js project then I found then socket is not connected to server but it is connected fine when i check it at localhost So how can i Get rid of that Problem

Hi, @mohitmittal11!

From the relevant documentation:

Edge Functions and Serverless Functions do not support acting as a WebSocket server.
We recommend third-party solutions to enable realtime communication for Deployments.

And from the relevant guide:

The two main approaches to apply this model to stateless serverless functions are:

  1. Serverless Functions have maximum execution limits and should respond as quickly as possible. They should not subscribe to data events. Instead, we need a client that subscribes to data events and a serverless function that publishes new data. Consider using one of the providers below to implement this approach.
  2. Rather than pushing data, you can fetch realtime data on-demand. For example, the Vercel dashboard delivers realtime updates using SWR.