Esri Leaflet

Add a Stream Service

This demo displays a real-time data feed from a service published using the GeoEvent extension for ArcGIS Server using a WebSocket. In addition to Esri Leaflet, it relies on Esri Leaflet Stream.

  <meta charset=utf-8 />
  <title>Add a Stream Service</title>
  <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />

  <!-- Load Leaflet from CDN-->
  <link rel="stylesheet" href="" />
  <script src=""></script>

  <!-- Load Esri Leaflet from CDN -->
  <script src=""></script>

    body { margin:0; padding:0; }
    #map { position: absolute; top:0; bottom:0; right:0; left:0; }

<script src=""></script>

<div id="map"></div>

<script type='text/javascript'>
  var map ='map').setView([47.59242, -122.31727], 12);


  function createRandomFill(){
    return '#'+(Math.random()*0xFFFFFF<<0).toString(16);

  var buses = L.esri.streamFeatureLayer({
    url: '',
    pointToLayer: function (geojson, latlng) {
      return L.circleMarker(latlng, {
        fillColor: createRandomFill(),
        fillOpacity: 0.8,
        color: "#cccccc",
        weight: 2