Mixing initial loading and events for CZML

Hello one questoin about something I am trying to do but impossible to make it working

I am looking to be able to load a couple of entities using a full CZML request and every n sec, updating some entities if necessaey using an Events CZML format

Unfortunatelly impossible to have it working !!!

Here the way I am doing
both files are OK

For test, I am doing a new Events file every 3sec changing one entity label color and scale but only the first events is displayed

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

czmlStream.load(‘http://www.xxxxx.com/xxxxx/metar.czml’);

var czmlEventSource = new EventSource(‘http://www.xxxxx.com/xxxx/metarEvents.czml’);

czmlEventSource.addEventListener(‘czml’, function(czmlUpdate)
{
czmlStream.process(JSON.parse(czmlUpdate.data));
}, false);

``

any idea, if

1- this is the good way to do?
2 -what is wrong?

thanks

Bruno

EventSource is more designed for use with web services and long-poll connections that stay open, allowing a server to push updates to the client as they occur, not really for files on disk. It’s not clear from your code what the content of metarEvents.czml is, but keep in mind that EventSource has it’s own specific format for how packets of data are sent. Consult the documentation for EventSource for the format.

If you’re simply regenerating static CZML files on disk periodically, you can ignore EventSource entirely and just add code to your application to periodically call process with the URL, and the file will be re-downloaded and processed (assuming your caching response headers are correct).

EventSource also never really gained much traction in browsers, and is still not implemented in Internet Explorer (and at this point, I assume it never will be). For an application that truly needs to push updates from server to client, WebSockets are a more modern approach.

Hi Scott

Yes my events CZML is compliant with the correct format
here the correct url to look at http://www.dreaminglobe.com/mapfly/acrj.html

I am targetting to use Events to slow down the number of information to download for the users. In particular because I am targetting to use this on a smarphone/tablet connected to 3G when flying in a “small” airplane. So better to slow down the number of data

My actual progress is displaying Mertar/Taf information updated every 30 min (or faster when necessary), and also tracking Airplanes flying when the “captain” is sending in live his positions to my server

So the more it is optimized, the better it will be for an “embedded” usage

Actually my server side is “pretty simple”. Not managing session per users. Reading your ansewer I can understand it will be better to manage sessions. But at the moment I am more focused on something working rather something perfect but asking a more elaborated solution. And I think that a good usage of regarlar CZML and Events CZML can do the stuff

BR