diff --git a/README.md b/README.md index 49d9b1f..bb70c73 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Chirp Server -_Twitter Streaming Server_ - Example for the book _Mastering D3.js_ +Twitter Streaming Server. Example for the book _Mastering D3.js_. ## Installing @@ -8,18 +8,24 @@ To run the code in this repository, you will need Node, [Twit](https://github.co 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) diff --git a/chirp.js b/chirp.js index c852891..a794650 100644 --- a/chirp.js +++ b/chirp.js @@ -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 diff --git a/package.json b/package.json index 54fcbf0..23a181c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chirp-server", - "version": "0.2.0", + "version": "0.2.1", "description": "Twitter Streaming Server", "main": "README.md", "repository": {