forked from pnavarrc/chirp-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
19 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters