I am working on a project builded with NodeJs (ExpressJS) and AngularJS (Front-end).
I have a map which display geoJSON polygons on it. The color of the polygon must be read from a real-time data file. The colors might be updated every second.
For the moment, angularJS is making a $http.get
request every second
$interval(function(){
MapService.getRealTimeData().then(function(resp){
$scope.showDataError = false;
$scope.geojson = createGeoJsonObject(resp.data);
}, function(err){
$scope.showDataError = true;
});
}, 1000)
The $http calls a ExpressJS API which read the file and send back a geojson.
Is it a good way to do it ? Should I change it and use Socket.io ? Should the server send the data when the real-time data file changes ?
EDIT
Thanks for the comment, I will keep this way of working with the call every second. Sorry for asking this kind of "question" but thanks for your help.