is refetching every second a bad idea?

I am creating an auction app,users fire mutation on click that writes current bid in db but in order to synchronize changes on every client I have set the query that gets that data on refetchinterval 1000,expected use case is about 50 users for around 1 hour,should I maybe do that some other way ?
10 Replies
cje
cje2y ago
you probably want websockets
joshborseth
joshborseth2y ago
^^
Lgy
LgyOP2y ago
can you do that with trpc and deploy on vercel?
JacobMGEvans
JacobMGEvans2y ago
agreed
Ben
Ben2y ago
Are you sure you can do WS and deploy to vercel? Once you add sockets, you need a persistent server, I don't think their's a way to do that with NextJS?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Ben
Ben2y ago
Pusher is just a SaaS that lets you do realtime messaging via their API, pretty useful if you're trying to set up something like a chatroom
Lgy
LgyOP2y ago
Is there a way to persist data using web sockets? Let’s say I use usestate to set all clients data that one of them sends,for simplicity let’s say I have a button that simply adds 1 to the displayed number ,when someone refreshes they get the value use state initially set for them and if they press the button it goes to initial state +1
lanc3
lanc32y ago
Not super sure what you mean by persisting data, but WS is event driven so if you wanted, every time a user clicked the button, you sent an event to the WS server saying button pressed or whatever and then you could tell the WS server to send an event to all the listeners or users on that event
Scot
Scot2y ago
You should define your requirements Most importantly “when a bid is made, how long until everyone else sees that information”
Want results from more Discord servers?
Add your server