To connect to Earthquake Streams data feed you need to use a pusher library such as https://github.com/pusher/pusher-js
Live Demo Code @ https://codepen.io/mapdev/pen/XaexdY
To connect you need
- Pusher Key: cb8e92ce5edfd617ee0a
- Pusher Cluster: mt1
- Event Name: earthquake
- Channels [all]
Currently there is only the one channel all but other will be available soon
There are 6 channels:
- all
- minor
- light
- strong
- significant
- tsunami
- All data is fired to a earthquake event
- All earthquake alerts are sent to the all channel
- Significant earthquakes are sent to the significant channel
- Earthquakes that may create a tsunami are sent to the tsunami channel
- The other three channels, minor, light, and strong are based on magnitudes <2.5, <4.5, and >4.5 respectivily
Below is a code snippet to connect in JavaScript
Include this in the <head>
<script src="https://js.pusher.com/4.1/pusher.min.js"></script>
Setup Pusher
var pusher = new Pusher('cb8e92ce5edfd617ee0a', {
cluster: 'mt1'
});
Connect to a specific channel
var channel = pusher.subscribe('all');
Listen for an earthquake
channel.bind('earthquake', function(data) {
console.log(data);
});
I can not see any data on the site. I see a never-ending spinner with text 'Awaiting New Earthquake Detection' - it is not clear if this is the intended view for 'no earthquakes right now' or if the site is broken. Also I can not find the issue tracker here on github so I can not report, that is why I am writing here.