StreamLayer

3586
3
12-09-2013 06:10 AM
TomPaschke
Esri Contributor
Hi all,

I have a problem creating a streamlayer from a web socket output using the JavaScript API 3.7.

The demo from the tutorial "Working with Web Sockets" using JS API 3.5 is working fine but I didn't manage to transfer it to the 3.7 version.

The 3.7 sample script (https://developers.arcgis.com/en/javascript/jssamples/layers_streamlayer.html) is not working as well. Hence, I wonder if you have a working sample of a stream layer using JS API 3.7?

Thank you.

Best,
Thomas
3 Replies
JamesCardona
New Contributor II
Thomas,

At version 3.7 of the javascript api, the message event changed.  The event now receives an array of raw features instead of a Graphic. This was done to allow a developer to intercept a message from the websocket connection before the message got converted to a graphic and added to the map.  To get the Graphic that was added to the map, a developer should handle the graphic-add event on the layer.

I've attached the updated sample; the change is on line 164. The updated sample will be included with the next documentation updates.

--James Cardona
0 Kudos
TomPaschke
Esri Contributor
James,

Thank you very much for your help!

Thomas
0 Kudos
nicogis
MVP Frequent Contributor

if you interested I have written a post for using a websocket (c#) with streamlayer

NicoGis - Sviluppare in ambiente ArcGIS...: WebSocket con StreamLayer