I'm trying to build a flutter app which shows a chart that reads data from a MySql database (a table)
I want to update the chart when the data in the table is updated without manually refresh the page
the table is updated by a script run by a cronjob (hourly, for example)
the first way that comes to my mind is using flutter's Timer.periodic function so that the app can periodically check the table if there is any update
but, in this way, I can not get a real-time update (to do so is seriously expensive)
So the second way I could think of is using WebSocket however, I'm sure if it's possible or an appropriate way to do this.
because I don't know how to do that. should the app (flutter) websocket commnunicate with Mysql? should I implement backend websocket to let flutter know the update?
Using WebSocket is the best way to implement real-time update chart application? Or are there any other ways that can solve this issue?
Thank you for whoever answer to this question.