Usually I make content refresh automatically with the javascript function using setInterval. But it seems ineffective because every second the content must be reloaded will take up a lot of resources.
Therefore if there is another alternative to creating an automatic refresh function only when the data has changed in the database.