C
C#3y ago
Sernik

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
Timtier
Timtier3y ago
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.
Sernik
SernikOP3y ago
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
Timtier
Timtier3y ago
Gl!
Tvde1
Tvde13y ago
That's the way to go 👍
Want results from more Discord servers?
Add your server