Dynamic data using WebSockets/EventSource example

Hi list,

We just started using Cesium and it looks great.

I was looking for an example of how to use EventSource or even better WebSockets to send dynamic updates of the data to Cesium but I wasn't able to find one.

Does anyone have some pointers or even better a complete example on how to handle dynamic data sending in Cesium?

Greatly appreciated. Thanks.

Best,
Oliver

I just started using Cesium with a websocket approach to dynamically add points to a line.

In the websocket onmessage function, I basically did the following:
var positions = polyline3D.getPositions();
positions.push(widget3D.centralBody.getEllipsoid().cartographicToCartesian(Cesium.Cartographic.fromDegrees(data.lon,data.lat,parseFloat(data.alt))));
polyline3D.setPositions(positions);

I found that after many points in a single polyline the interaction began to drag and posted a question on this forum here:
https://groups.google.com/forum/embed/?place=forum/cesium-dev&showsearch=true&showpopout=true&hideforumtitle=true&parenturl=http%3A%2F%2Fcesium.agi.com%2Fforum.html#!topic/cesium-dev/KIafPg_vZdg

The solution (still testing) was to use many polyline collections where the polyline within a collection only has 1024 points. So every 1024 points, I would create a new polyline collection and a new polyline that would be used on the next websocket update.