I am trying to integrate live point data (worker locations) from Workforce for ArcGIS into a Javascript web app that I am building.
The layer loads fine and displays on the map properly, it even refreshes as soon as I zoom in or out, but it does not refresh automatically no matter what I try. I have tried using .refreshInterval and when I log the FeatureLayer it has the property set correctly but no refresh happens.
esriId.registerToken({
server: 'https://www.arcgis.com/sharing/rest',
token: sessionStorage.getItem('token'),
userId: sessionStorage.getItem('user')
});
var portal = new Portal({
authMode: 'immediate'
});
portal.load().then(function() {
var query = {
query: 'title:workers_ AND access:shared AND type:Feature Service'
}
portal.queryItems(query).then(function(queryResult) {
workers = new FeatureLayer({
title: 'Workers',
refreshInterval: 0.1,
portalItem: queryResult.results[0]
});
workers.when(function() {
workers.makeTemplate();
console.log(workers);
});
map.add(workers);
});
});
I have also tried using
setInterval(function() {
workers.refresh();
console.log('hi');
}, 6000);
This logs hi every time but still does not refresh the layer. There are no errors of any kind in the console either. I have tried in both most recent Chrome and most recent Edge.
Does anyone know what the problem is/how to fix it?