0.0.3 • Published 9 years ago

murtignip v0.0.3

Weekly downloads
84
License
-
Repository
github
Last release
9 years ago

Murtignip

A Node.js client for consuming Gnip. Connect to the Gnip Powertrack 2.0 Streaming API and manage your rules. You must have a Gnip account with Twitter PowerTrack available and enabled.

Murtignip.Powertrack.Stream

The stream is an EventEmitter that allows you to connect to a PowerTrack 2.0 stream and start receiving data.

API Methods

stream.start()

Connect to the stream and start receiving data from Gnip. You should have registered at least one event listener for any of the following events from the stream:

  • data
  • share
  • post

stream.end()

Terminates the connection to the stream.

Events

Event NameDescription
dataEmitted for each content item received.
errorEmitted when the response received is not a 200 OK.
endEmitted when the stream has been ended.
postEmitted for each content item received that has a verb value of post.
shareEmitted for each content item received that has a verb value of share.

Installation

npm install murtignip

Example Usage

var Murtignip  = require('murtignip');

var powertrack_options  = {
  account_name: "<your Gnip account name>",
  user:         "<your Gnip user name>",
  password:     "<your Gnip password>",
  stream_name:  "<your Gnip Powertrack Stream name, ex. 'prod'>"
};

var stream  = new Murtignip.Powertrack.Stream(powertrack_options);

stream.on('error', function(err){
  console.error(err);  
});

stream.on('data', function(data){
  console.dir(data);  
});

stream.on('post', function(data){
  console.dir(data);  
});

stream.on('share', function(data){
  console.dir(data);  
});

stream.start();