Create a gist now

Instantly share code, notes, and snippets.

@davidpiesse /info.md
Last active Jan 31, 2018

What would you like to do?
Earthquake Stream Connection - Pusher

Earthquake.stream

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

Required Keys

To connect you need

  • Pusher Key: cb8e92ce5edfd617ee0a
  • Pusher Cluster: mt1
  • Event Name: earthquake
  • Channels [all]

Channels

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

Code

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);
});
@wowcut

This comment has been minimized.

Show comment Hide comment
@wowcut

wowcut Aug 23, 2017

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.

wowcut commented Aug 23, 2017

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.

@davidpiesse

This comment has been minimized.

Show comment Hide comment
@davidpiesse

davidpiesse Jan 31, 2018

Hi @wowcut - Earthquake Stream has been in hibernation and has only just been restarted. Should be working now

Owner

davidpiesse commented Jan 31, 2018

Hi @wowcut - Earthquake Stream has been in hibernation and has only just been restarted. Should be working now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment