Skip to content

Example ExpressJS application that uses SocketIO to show a steady stream of nearby tweets

Notifications You must be signed in to change notification settings

brock/twitter-streaming-socketio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

twitter-streaming-socketio

Example ExpressJS application that uses SocketIO and Bootstrap to show a steady stream of nearby tweets

Demo

demo

Setup

This project uses the twit NPM module to utilize the Twitter Streaming API, so you will need to register a new app at apps.twitter.com and get a consumer key and access token (this is free).

Once you have an app registered with Twitter, create a file called config.js in the project root (this is already gitignored) add the following keys:

module.exports = {
    consumer_key: 'REQUIRED'
  , consumer_secret: 'REQUIRED'
  , access_token: 'REQUIRED'
  , access_token_secret: 'REQUIRED'
}

Once you have your keys and tokens in your config.js, you're ready to start the application:

npm install
bower install
npm start

The application can be viewed at http://localhost:3000

Customize

When you first start this application, you will see tweets from Champaign, Illinois. To see tweets near you, update index.js to the coordinates of your location.

Twitter expects this to be an array of coordinates, starting in the Southwest corner, and ending in the Northeast corner (more info on dev.twitter.com). You can also use geojson.io to easily identify nearby coordinates.

Note that this is a single array with four elements, not a polygon or nested array of points. Several sample locations are provided.

// Champaign-Urbana, Illinois, USA
var location = [ '-88.45', '40.04', '-88.10', '40.19' ];

// Chicago
var location = [ '-87.79', '41.71', '-87.63', '42.02' ];

// San Francisco
var location = [ '-88.45', '40.04', '-88.10', '40.19' ];

// NYC
var location = [ '-74.02', '40.69', '-73.93', '40.79' ];

// London
var location = [ '-0.18', '51.47', '-0.00', '51.55' ];

// Tokyo
var location = [ '139.18', '35.36', '140.13', '35.93' ];

About

Example ExpressJS application that uses SocketIO to show a steady stream of nearby tweets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published