user-stream

Simple twitter user stream client. Only one dependency (oauth).

user-stream

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

npm install user-stream

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);
});
  • 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
  • stream - create stream connection
  • destroy - destroy/close stream connection

Streaming API request parameters link

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