DEV Community

Cover image for Building a real-time bidding system with Socket.io and React Native đŸ€©

Building a real-time bidding system with Socket.io and React Native đŸ€©

Nevo David on November 15, 2022

What is this article about? Goin’ Once, Goin’ Twice, Sold to the lady with the red dress đŸ’ƒđŸ» You have probably heard that many times in m...
Collapse
 
nevodavid profile image
Nevo David

Image description

Collapse
 
nevodavid profile image
Nevo David

How are you today?

Collapse
 
nevodavid profile image
Nevo David

Have you worked with React Native before?

Collapse
 
jcmaciel profile image
José Carlos Maciel

Hi, I got "Network request failed", can you help me?

Collapse
 
user1111333 profile image
Sacred (void*)

Some browsers/platforms reject non-secure websocket(ws://) connections/handshakes.
Fix is easy tho, as adopting https, and the same story for WS, using wss://...

Collapse
 
jcmaciel profile image
José Carlos Maciel

Thanks!!

Collapse
 
r4e profile image
Richie Permana

How would you handke the concurrent event when users is bidding at the exact same time and price? 😆

Collapse
 
imsuvesh profile image
Suvesh K

On server check the price before updating, incoming bid must be greater that current price.
If both users bid at same time who's request comes first will update the price and second will see error to increase bid.

Collapse
 
r4e profile image
Richie Permana

Thanks for the reply. Really love the discussion!

But anyway, I get your point but actually....it's not that simple. Well, your point technically, yes, but actually no. Sometimes, the implementation is much harder than you think.

For me, my approach is using Redis to solve this problem instead of DB transactions.

Collapse
 
asubodh profile image
Subodh Aryal

🚀

Collapse
 
nevodavid profile image
Nevo David

đŸ€©

Collapse
 
wilmela profile image
Wilmela

Nice

Collapse
 
nevodavid profile image
Nevo David

Thank you Wilmela! đŸ€©