Real Time Data With Flask?
Solution 1:
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.
Post a Comment for "Real Time Data With Flask?"