I am using Cesium to display a subset of the Iridium Next constellation, and I am loading sats via the following:
// satData is the valid CZML sent from the backend over the socket
viewer.dataSources.add(Cesium.CzmlDataSource.load(satData)).then(function (datasource) {
ds = datasource;
});
But then I go to remove the satellite's CZML from the Cesium Viewer DataSources when the socket that sent the data disconnects:
if (viewer.dataSources.contains(satData)) {
// satData represent whichever data was past to the frontend from the
// socket that just disconnected
var removalPromise = viewer.dataSources.remove(satData);
Cesium.when(removalPromise, function() { console.log('The promise has resolved') });
}
And I get the following error ONLY WHEN THE NUMBER OF SATELLITES IS GREATER THAN 1 - it works on 1 satellite: