0

I have a flask web app that shows data from sqlalchemy to the user. I want the app to fetch any new data when it is added to the database automatically without further ado from the client-side (something like news feeds). How do I achieve that. I know that I should use socket.io but don't know-how. All examples in google are about chat app. It would be very helpful if somebody could give me the roadmap to do it. The front end in js and the backend is in flask python. any help will be appreciated! Thanks

davidism
  • 121,510
  • 29
  • 395
  • 339
Abood
  • 21
  • 7

1 Answers1

1

If you want to change content of the page without reloading then using ajax could be best solution but if you want to change the content in real time (after new data added into database) the you may wait for other answers. Here's the idea for ajax.

imxitiz
  • 3,920
  • 3
  • 9
  • 33
  • thank you for your answer but I need the update to be in real-time! – Abood Jul 09 '21 at 16:27
  • Try visiting these sites and do your own research about it.https://medium.com/@abhishekchaudhary_28536/building-apps-using-flask-socketio-and-javascript-socket-io-part-1-ae448768643 https://codeburst.io/building-your-first-chat-application-using-flask-in-7-minutes-f98de4adfa5d this will help you to understand sockets.io and how it works and made your decision weather to work with this or there could be other alternatives for this also. – imxitiz Jul 09 '21 at 16:37