vendredi 28 mai 2021

How to execute function in backends every x minutes

This is my issue:

  • I have an API which updates every 30 seconds the result displays on an endpoint
  • I want to display the result on my website for all visitors and so update it automatically every 30 seconds

I don't want each visitor to send a request on my API as it would overwhelm the API (and it is clearly not the right way to implement it I guess).

Is there a way to send one request every 30 seconds from my website backend to my API in order to display it for all visitors on the website? Or maybe there is another smarter/efficient way to do it?

Another question I'm asking, I want exactly the same "front" website content for all users. I mean, there would have requests from frontend to backend to have the information, but I don't want some users to have the information earlier as their requests would be few seconds before other users. I was thinking to "send requests based on GMT+1 hour for example", I don't know if it makes sense or if there is another way ?

N.B.: I'm using Wix services, maybe I would have to change and build my proper website

Thanks a lot for your answers Hugo




Aucun commentaire:

Enregistrer un commentaire