twitter-streaming-client
Twitter Streaming API Client.
Installation
$ npm install twitter-streaming-client
Example
The following code connects to User Stream and displays statuses.
var format = format;var userStream = userStream; var oauth = consumer_key: '<CONSUMER KEY>' consumer_secret: '<CONSUMER SECRET>' token: '<ACCESS TOKEN>' token_secret: '<ACCESS TOKEN SECRET>'; { console;} ;
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 receiveddelete
(status): when a status is deletedfavorite
(event): when a authorized user's status is favoritedfriends
(friends): when authorized user's friends data are recivederror
(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.