"Invalid array length" error when streaming CZML

Hi everyone, I'm trying to get a CZML streaming example working, but I keep getting errors (using Cesium version b28). I have verified that my CZML data is getting received properly in my front end javascript, and I am able to get it to plot on the map if I take the CZML and basically hard code it in the javascript and plot it using czmlDataSource.load(hardcodedCzml);

When I try to stream it, however, I can see that the first item DOES plot, but then I get an error and nothing further will plot. The error says:

"An error occurred while rendering. Rendering has stopped.

RangeError: Invalid array length
  at Cesium.js:412:9312
  .......
  at Cesium.js:419:9987
"

Here is the javascript code I'm trying to use for streaming (some variable names changed for clarity):

function onMessageReceivedFromBackEnd(message)
{
   var czmlDataFromBackEnd = $.parseJSON(message);
   processCzmlPacket(czmlDataFromBackEnd);
}

function processCzmlPacket(czmlDataFromBackEnd)
{
   var czmlDataSource = new Cesium.CzmlDataSource();
   czmlDataSource.process(czmlDataFromBackEnd);
   viewer.dataSources.add(czmlDataSource);
}

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.extend(Cesium.viewerDynamicObjectMixin);

Here is an example of what my CZML string looks like when I hardcode it for testing purposes using the data from the back end:

var czmlPacket = [{
   "id" : "1000",
   "position": {
      "epoch": "2012405-02T12:00:00Z",
      "cartographicDegrees": [34.53306630427008, 69.16609247498154, 0.0]
   },
   "billboard" : {
      "eyeOffset" : {
        "cartesian" : [ 0.0, 0.0, 0.0 ]
      },
      "horizontalOrigin" : "CENTER",
      "image" : "data:image/png;base64,iVBORw0KG/*long string here*/",
      "pixelOffset" : {
        "cartesian2" : [ 0.0, 0.0 ]
      },
      "scale" : 0.459,
      "show" : [ {
        "boolean" : true
      } ],
      "verticalOrigin" : "BOTTOM"
    }
}];

Is there anything I'm missing here? I couldn't find a good example of streaming CZML, so I'm sure I've done something dumb and the fix is simple :slight_smile: I originally did not have the epoch field in there, but I had to add it in order to get rid of an error that said something about addSeconds having an issue. Some other things I've added just to see if something will fix it, so you'll see some things are probably not necessary, like the eyeOffset being set to all 0's, etc. No matter what I try, however, I can't get rid of the error and get all my data plotted. In case it matters, each of the ID's coming in are different, so it shouldn't be trying to update an existing item, though that will be the case at times during my stream.

Any help is greatly appreciated!

Ok I think I fixed it by moving these 2 lines:

var czmlDataSource = new Cesium.CzmlDataSource();
viewer.dataSources.add(czmlDataSource);

Out of the "loop" and only executing them once in the beginning. The loop then only makes the "czmlDataSource.process(czmlDataFromBackEnd);" call.