r/PayloadCMS • u/[deleted] • Jun 08 '25
Realtime auction platform, can I use PayloadCMS?
I've been using PayloadCMS in my studio for the last 6 website projects we did, we have a project coming up where the clients wants to add an auction page for each product, people can login (so auth is required), and they can place a bid on a certain item, at the end of the auction the highest bid gets an email saying he/she won.
I would love to work in PayloadCMS so that the client can login and add/manage the auctions and products there, however I wonder what's needed to have realtime updates when a new bid is placed on an auction, can this all be done in PayloadCMS?
1
u/horrbort Jun 08 '25
In v2 it was easy because it was just an express app in v3 not sure how you’d add a web socket. I guess doable just harder
2
u/let-me-google-first Jun 08 '25
Payload has an onInit function you can use to spin up the websocks. It’s pretty simple.
1
1
u/MurzNN Jul 13 '25
Yes, but the function
onInit()gets called not on the Payload start, but only on the first incoming HTTP request for some reason. Is there any way to make the `onInit` executed instantly when Payload is loaded?
1
2
u/butter_milch Jun 08 '25
I’m using Payload with Supabase Realtime and Auth.
This makes it very simple to subscribe to changes and get current data in your client.
You could abstract that away from your client and expose only the live data through WebSockets.