Skip to content

Instantly share code, notes, and snippets.

@davidpiesse
Last active January 31, 2018 15:55
Show Gist options
  • Select an option

  • Save davidpiesse/658f74e41b3317a7c99335743b66e4d0 to your computer and use it in GitHub Desktop.

Select an option

Save davidpiesse/658f74e41b3317a7c99335743b66e4d0 to your computer and use it in GitHub Desktop.

Revisions

  1. davidpiesse revised this gist Jan 31, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion info.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ To connect you need

    Currently there is only the one channel **all** but other will be available soon

    There are 6 channels currently available
    There are 6 channels:
    - all
    - minor
    - light
  2. davidpiesse revised this gist Jan 31, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion info.md
    Original file line number Diff line number Diff line change
    @@ -10,10 +10,12 @@ To connect you need
    - Pusher Key: **cb8e92ce5edfd617ee0a**
    - Pusher Cluster: **mt1**
    - Event Name: **earthquake**
    - Channels **[all,minor,light,strong,significant,tsunami]**
    - Channels **[all]**

    ### Channels

    Currently there is only the one channel **all** but other will be available soon

    There are 6 channels currently available
    - all
    - minor
  3. davidpiesse revised this gist Aug 14, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions info.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@

    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
  4. davidpiesse revised this gist Aug 2, 2017. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions info.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,14 @@

    To connect to Earthquake Streams data feed you need to use a pusher library such as https://github.com/pusher/pusher-js

    ### Required Keys

    To connect you need
    - Pusher Key: **cb8e92ce5edfd617ee0a**
    - Pusher Cluster: **mt1**
    - Event Name: **earthquake**
    - Channels **[all,minor,light,strong,significant,tsunami]**

    ### Channels

    There are 6 channels currently available
  5. davidpiesse revised this gist Aug 2, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions info.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    ### Earthquake.stream
    # Earthquake.stream

    To connect to Earthquake Streams data feed you need to use a pusher library such as https://github.com/pusher/pusher-js

    ## Channels
    ### Channels

    There are 6 channels currently available
    - all
    @@ -18,7 +18,7 @@ There are 6 channels currently available
    > - 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
    ### Code

    Below is a code snippet to connect in JavaScript

  6. davidpiesse revised this gist Aug 2, 2017. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions info.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    ###Earthquake.stream
    ### Earthquake.stream

    To connect to Earthquake Streams data feed you need to use a pusher library such as https://github.com/pusher/pusher-js

    ##Channels
    ## Channels

    There are 6 channels currently available
    - all
    @@ -18,6 +18,8 @@ There are 6 channels currently available
    > - 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>```
  7. davidpiesse revised this gist Aug 2, 2017. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions info.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,17 @@
    ###Earthquake.stream

    To connect to Earthquake Streams data feed you need to use a pusher library such as https://github.com/pusher/pusher-js

    > **Channels:**
    ##Channels

    > - There are 6 channels currently available
    There are 6 channels currently available
    - 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
  8. davidpiesse created this gist Aug 2, 2017.
    43 changes: 43 additions & 0 deletions info.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    To connect to Earthquake Streams data feed you need to use a pusher library such as https://github.com/pusher/pusher-js

    > **Channels:**
    > - There are 6 channels currently available
    - 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>```

    ```html
    <script src="https://js.pusher.com/4.1/pusher.min.js"></script>
    ```

    Setup Pusher
    ```javascript
    var pusher = new Pusher('cb8e92ce5edfd617ee0a', {
    cluster: 'mt1'
    });
    ```

    Connect to a specific channel
    ```javascript
    var channel = pusher.subscribe('all');
    ```

    Listen for an earthquake
    ```javascript
    channel.bind('earthquake', function(data) {
    console.log(data);
    });
    ```