News for hackers. Stuff that matters.
Re:Ask HN: What was your most humbling learning moment? by malkosta on Sunday June 02, 2024 @07:01PM (#40557808)
When I was working in a queue feature (for example to buy tailor swift ticket), and was proud of my complicated real-time solution using websockets and CRDTs...then a more experienced guy came, rearchitected in a much simpler way using just the DB with long-polling, not real real-time (but who cares), and it ended up simpler to deal with network splits or crashes. Learned the hard way you can never rely on the network if you require consistency, and it's also often simpler code-wise.
Re:Ask HN: What was your most humbling learning moment? by jpeggtulsa on Sunday June 02, 2024 @11:55PM (#40559185)
One of the earliest projects I took over from a higher level developer was an auction website back around 1998. The site worked like eBay in as far as you could put a maximum bid, and it would automatically bid higher than the last bid up to that point. The problem was, it was all dependent on users being on that page so that the auto-reload http header would fire again and refresh the page. If nobody was on the site watching the auction, no automatic bids would happen and nobody would be declared the winner.
Re:Ask HN: What was your most humbling learning moment? by bombcar on Monday June 03, 2024 @11:33AM (#40563708)
The number of "web cron" things in tools like Wordpress and friends is insane; I've been bit a number of times by this - if nobody hit the site for a day, none of the crons would fire.

Big website, no problem. Small internet site, big problem.

(Yes, for some cron + wget/curl was whipped out)

Re:Ask HN: What was your most humbling learning moment? by dehrmann on Monday June 03, 2024 @02:17AM (#40559840)
People often forget that you have to poll to handle lost network connections, IP changes, etc., so there isn't always a real-world win to web sockets.
Re:Ask HN: What was your most humbling learning moment? by mdavid626 on Monday June 03, 2024 @09:00AM (#40562238)
How about reconnecting the websocket from the client?
Re:Ask HN: What was your most humbling learning moment? by dehrmann on Monday June 03, 2024 @12:55PM (#40564590)
Sounds like polling. On an inactive connection, whatever it is, you have to always be polling to see if the connection is still alive.
Re:Ask HN: What was your most humbling learning moment? by mdavid626 on Tuesday June 04, 2024 @09:17AM (#40574288)
What do you mean? The client knows when the websocket connection goes down and just reconnects. How is this polling?
Re:Ask HN: What was your most humbling learning moment? by malkosta on Thursday June 06, 2024 @09:26PM (#40604413)
Because it always needs some sort of keep alive, which is many times hidden inside the client/web framework
Re:Ask HN: What was your most humbling learning moment? by mdavid626 on Friday June 07, 2024 @07:25AM (#40607527)
But isn't a keep alive bit better than a "full" polling?