Skip to content

Sinatra: Server sent events. Every 30 seconds, display on a map the latest USGS earthquake.

Notifications You must be signed in to change notification settings

greghorne/Shake-Shake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shake-Shake

Server-Sent Events (SSE in HTML5)

Overview:

  • This application is written in Ruby/JS and deployed as a Sinatra application.
  • The purpose of this project is to demonstrate Server-Sent Events which is a server to client communication protocol (one-way).
  • Note that Server-Sent Events are not supported by IE/Edge as of this writing.
  • Wikipedia: https://en.wikipedia.org/wiki/Server-sent_events

What does this webpage do:

  • Display in client browser a map.
  • Server polls USGS every 30 seconds for earthquakes that have occured within the last 15 minutes.
  • Note that the USGS information is not necessarily instantaneous meaning for example an earthquake that occurred 10 minutes ago might only be reported by the USGS within the last few minutes.
  • The intent of the webpage is to display the latest earthquake that has occurred within the past 15 minutes as reported by the USGS.
  • When a new earthquake event is received by the server, such information is pushed to the client browser repositioning the map and displaying information about the event.
  • If the initial map displayed is a view of the entire USA with no marker on the map signifying an earthquake, this means an earthquake has not been recorded in the last 15 minutes. Thus just leave the webpage as is and wait.
  • If the browser's developer's console is open, one can observe the messages being sent to the client from the server.

Tech Stack:

Local Deployment/Execution (Ubuntu):

  • Clone this repository to a folder
  • Confirm ruby, sinatra and sinatra-contrib is installed
  • Execute "bundle install"
  • Execute "ruby app.rb -o 0.0.0.0"
  • Open a web browser and navigate to: "0.0.0.0:4567"

This webpage can be more fun than watching paint dry.

Deployment: http://zotac1.ddns.net:3200

About

Sinatra: Server sent events. Every 30 seconds, display on a map the latest USGS earthquake.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published