Hello I am trying to build an application using flask and the twitter stream API. What I would eventually like to do is update a map in real time with tweets based on their attached geolocation data. What would be the best option for me to send real time data to the user without a page refresh? Is Ajax an option? I also looked into Juggernaut which now seems to be depreciated. Any help steering me in the right direction would be greatly appreciated.
There are a couple things you can do. The first is using ajax, where you just set an interval for each request to the REST api. The other option would be to use websockets. Here is some documentation to implement websockets with python https://ws4py.readthedocs.org/en/latest/. Using ajax would be the easier solution, but websockets is a better one.
If you are unfamiliar with websockets, the idea is that a server can send a message to the client. So when someone goes to your website a connection opens between the client and server. On the server side when you stream some data with a geolocation and you want to display it on the map, the server can send a message to the client with the data. That way, everything displayed on the map is in real time and you dont have any more requests than necessary.