Node.js Twitter user stream module.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Latest commit 6eaa72e May 26, 2015
Permalink
Failed to load latest commit information.
lib Fixed chunk reconstruction and JSON parsing. May 14, 2015
test files Oct 26, 2012
.gitignore request close fix Oct 29, 2012
README.md Update README.md Mar 28, 2014
index.js files Oct 26, 2012
package.json version update Oct 10, 2013

README.md

user-stream

NPM module

Simple Node.js Twitter (API 1.1) user stream client (https://dev.twitter.com/docs/streaming-apis/streams/user)

NPM

Install

npm install user-stream

Usage

var Stream = require('user-stream');
var stream = new Stream({
    consumer_key: '',
    consumer_secret: '',
    access_token_key: '',
    access_token_secret: ''
});

//create stream
stream.stream();

//listen stream data
stream.on('data', function(json) {
  console.log(json);
});

Events

  • data - stream data in JSON format
  • garbage - stream data who can't be parsed to JSON
  • close - stream close event (stream connection closed)
  • error - error event (request error, response error, response status code greater than 200)
  • connected - stream created
  • heartbeat - twitter emitted heartbeat

Methods

  • stream - create stream connection
  • destroy - destroy/close stream connection

Streaming API request parameters link

var params = {
    with: 'user'
}
//create stream
stream.stream(params);

Reserved parameters for lib

  • delimited
  • stall_warnings