SSE Alternative #7479
Replies: 1 comment 3 replies
-
You can't use SSE on Vercel because Vercel is a Serverless platform and SSE requires the server to keep running so the connection between the browser and the server is not closed, but Vercel will eventually stop the function that handled the SSE request. You will have to deploy the app somewhere else to keep using SSE.
Long-polling is a way simpler solution, use a resource route with a loader to let the business know when a booking happens and then use fetcher to request this resource route so you can get the last value, it will work perfectly with Vercel since Vercel will ensure the server will scale no matter how many requests you do. Other solution may include using WebSockets but then again you can't use Vercel, so long-polling is the simplest solution here. |
Beta Was this translation helpful? Give feedback.
-
I'm making a booking app, and when a booking happens, I want the business to be notified with a push notification, I had it working using SSE on dev environment, but when I deploy to vercel it won't work.
The business is expected to with the app open or installed as a PWA for this to work.
It doesn't need to be instant, if it's takes 1 or 2 minutes for the notification to show it won't make much difference. I know there's the thing where you can fetch the data every few second to see if there's any changes, I don't remember the name right now, but I don't know if there isn't a simpler solution that I'm not aware of.
Beta Was this translation helpful? Give feedback.
All reactions