Get data from api periodically
Hi everyone, I am making a blazor server web app, and i have to get data from api every 10 seconds and save it to database and update index.razor page with that data.
The question is, how can i get that data? I have to create service with timer and add it to services in program.cs? and which timer should i use?
Thanks for help!
4 Replies
It depends a bit on how your application works or is hosted. But often you would have something akin to a background job or worker running that would do this periodic updating.
thanks, i made this work using background service with periodic timer added as hosted service in builder, now ill try to update page with that new data
Gl!
That's the way to go 👍