Book Image

Mastering D3.js

Book Image

Mastering D3.js

Overview of this book

Table of Contents (19 chapters)
Mastering D3.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating the streaming server


In this section, we will use Node to create the streaming server. The server will handle the client connections and the connection to the Twitter-streaming API; it will also manage the list of topics for all the clients who deliver tweets as they arrive.

We will begin by creating Twitter authentication tokens; we will learn how to use the Twit module to manage the connection to the Twitter API, and how to use Socket.IO to handle real-time communication between the server and the client application.

To follow the examples in this section, open the chirp-server project directory in the terminal and run the following command to install the project dependencies:

$ npm install

This will create the node_modules directory and download the project dependencies. If you haven't installed Node, download the binaries for your platform from http://nodejs.org/download/ and follow the instructions on the page.

Using the Twitter-streaming API

Twitter provides a streaming API that...