var map = new Datamap({
    element: document.getElementById('map'),
    geographyConfig: {
        highlightOnHover: false,
        popupOnHover: false
    }
});

var geocoder = new google.maps.Geocoder();

var geocode = function(location, success, retries) {
    if (typeof(retries) === 'undefined') retries = 3;
    geocoder.geocode({'address': location}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            success(results);
        } else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
            if (retries > 0) {
                setTimeout(function() {
                    geocode(location, success, retries - 1);
                }, 1000);
            }
        } else {
            // ignore
        }
    });
}

var locs = [];

var source = new EventSource('/events');
source.onmessage = function(e) {
    var event = JSON.parse(JSON.parse(e.data));
    geocode(event.fromLocation, function(from) {
        geocode(event.toLocation, function(to) {
            var fromLoc = {
                latitude: from[0].geometry.location.lat(),
                longitude: from[0].geometry.location.lng()
            };
            var toLoc = {
                latitude: to[0].geometry.location.lat(),
                longitude: to[0].geometry.location.lng()
            }
            fromLoc.radius = 50; toLoc.radius = 50;
            locs.push(fromLoc); locs.push(toLoc);
            map.bubbles(locs);
        });
    });
};

@@ -1340,95 +1340,55 @@
     
-fromLoc.radius = 50; toLoc.radius = 50;%0A            locs.push(fromLoc); locs.push(
+locs.push(%7Borigin: fromLoc, destination: 
 toLoc
+%7D
 );%0A 
@@ -1406,20 +1406,34 @@
 map.
-bubbles(locs
+arc(locs, %7BstrokeWidth: 2%7D
 );%0A 

Switch to arcs