Skip to content

Commit

Permalink
Merge branch 'release/0.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
pnavarrc committed Jun 8, 2014
2 parents dc4b1fc + 8110524 commit 108e5ec
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
# Chirp Server

_Twitter Streaming Server_ - Example for the book _Mastering D3.js_
Twitter Streaming Server. Example for the book _Mastering D3.js_.

## Installing

To run the code in this repository, you will need Node, [Twit](https://github.com/ttezel/twit), [Socket.IO](http://socket.io/) and Twitter credentials. To obtain the Twitter credentials, go to [Twitter Developers Site](https://dev.twitter.com/), create an application and create access tokens for your application. You will need the consumer key, consumer secret, access token and access token secret and replace the values in the file `credentials.json`.

The dependencies on this project can be installed from the command line by typing:

npm install
$ npm install

## Running the Streaming Server

Update the `chirp.js` file to use your credentials (be sure to keep the credentials secret) and run the streaming server:

$ node chirp.js

The server will connect to the `statuses/filter` endpoint and begin listening the port 9720 for socket.io connections.

## Examples

To run the examples, execute the corresponding module in the terminal
There are examples of using the Twitter Streaming API and the Socket.IO library. To run the examples, execute the corresponding script in the terminal:

$ node 01-twitter-sample.js

The third example requires to open the `socketio-example.html` with the browser.

- [1. Twitter Sample](01-twitter-sample.js)
- [2. Twitter Filtering](02-twitter-filter.js)
- 3. Socket.IO Example
- [Server](03-socketio-example.js)
- [Client](socketio-example.html)
- [1. Twitter Sample.](01-twitter-sample.js)
- [2. Twitter Filtering.](02-twitter-filter.js)
- 3. Socket.IO Example [server](03-socketio-example.js) and [client.](socketio-example.html)
5 changes: 4 additions & 1 deletion chirp.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ var topics = [];
// Configure the Twit object with the application credentials
var T = new Twit(config);

// Filter by location (the world) and tweets in english
var filterOptions = {locations: '-180,-90,180,90', language: 'en'};

// Creates a new stream object, tracking the updated topic list
var twitterStream = T.stream('statuses/sample');
var twitterStream = T.stream('statuses/filter', filterOptions);

// Callbacks for Twit Stream Events

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chirp-server",
"version": "0.2.0",
"version": "0.2.1",
"description": "Twitter Streaming Server",
"main": "README.md",
"repository": {
Expand Down

0 comments on commit 108e5ec

Please sign in to comment.