Socket
Book a DemoInstallSign in
Socket

twitter-streaming-client

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitter-streaming-client

Twitter Streaming API Client

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

twitter-streaming-client

Build Status

Twitter Streaming API Client.

Installation

$ npm install twitter-streaming-client

Example

The following code connects to User Stream and displays statuses.

var format = require("util").format;
var userStream = require("..").userStream;

var oauth = {
  consumer_key: '<CONSUMER KEY>',
  consumer_secret: '<CONSUMER SECRET>',
  token: '<ACCESS TOKEN>',
  token_secret: '<ACCESS TOKEN SECRET>'
};

function printStatus(status) {
  console.log(format("%s %s\n%s\n\n", status.user.screen_name,
                     status.created_at, status.text));
}

userStream(oauth).open()
  .on("error", function(err) { console.log(err); })
  .on("status", printStatus);

Another example connected to Public streams is in the examples directory.

Events

Currently only following events are supported. Other events would be supported soon.

  • status(status): when a status is received
  • delete(status): when a status is deleted
  • favorite(event): when a authorized user's status is favorited
  • friends(friends): when authorized user's friends data are recived
  • error(err): when an error occurred

API

userStream(oauth)

Create a TwitterStreamClient that connects to User Stream.

publicStream(oauth)

Create a TwitterStreamClient that connects to Public streams.

TwitterStreamClient#open(requestOption)

Open a connection to Streaming API. Tracking keywords can be specified as { form: { track: "<comma separated keywords>" } } form in requestOptions.

TwitterStreamClient#close()

Close a connection to Streaming API.

Development

twitter-streaming-client takes advantage of Babel. Source code are in src directory and generated code are in lib directory.

Build

$ npm run build

Test

$ npm test

Lint

$ npm run lint

License

twitter-streaming-client is released under the MIT License.

Keywords

twitter

FAQs

Package last updated on 18 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts