The Problem

  • I have a live data feed
  • Users load 50 items on the home page and click load more to scroll infnitely
  • As new data comes in every minute, I also push this new data to each user via websockets
  • The user could be disconnected temporarily and they would miss a few updates and then they could reconnect in which case they would be OUT of SYNC with the backend
  • The way I thought I would fix this problem is to get the timestamp of the last item they have on their UI
  • Whenever the connection opens, I would send ALL the items from that timestamp till current time to each user
  • There is however a risk here
  • My server could be down for maintenance for a few hours when doing upgrades and on connecting back I would have to send 10000s of items to each user potentially causing the server to crash
  • The remedy that I thought of is to keep a time limit say 4 hours, if it has been more than 4 hours since the last item the user has on their UI, I would reset the UI completely

So the question is, how do I deal with this?

  1. Dont do anything, let there be that risk of server crash
  2. Clear the user s UI completely without asking the user even if they scrolled down 1000 items on their screen
  3. Keep a limit of say 50 items or so and send those 50 items, if it has been more than 4 hours, tell the user they may be out of sync and they need to refresh the page
  4. Any suggestions?

1 Answer 1

  • Clearly communicate the current state of the app/service/website to the user
  • Do not send the missed data to all users
  • Add a button to retrieve the missed data

This way users who need the data will get it and you will not put a load on your backend. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.