VoxPelli Tweet Streamer
A library for Twitters realtime streaming API that among other things has support for updating a stream on the fly without losing any tweets along the way and special support for tracking tweets from users in a way similar to Twitter lists by filtering away non-related tweets.
It's a work in progress - feel free to fork away but don't expect anything :)
OAuth-credentials: To get them register a Twitter app on https://dev.twitter.com/apps and when you've done so you can get a token for yourself from the configuration page.
var vptweetstream = stream;
stream = vptweetstream
- follow - an array of Twitter usernames to follow. Any tweet related to one of these users will be included in the stream, see Twitter's documentation for which kind of tweets that are included.
- track - an array of keywords to track. If a tweet includes the keyword in any variation it will be included in the stream, see Twitter's documentation for all variations.
- locations - either just a simple array containing the longitude and latitutude positions as two strings or an array containing several such arrays. Any tweet from within any of the specified bounding boxes will be included in the stream.
- realfollow - used with follow to simulate something like a Twitter list where only the tweets that's actually from the followed persons are included. Set to true to activate.
- tweet - triggered whenever a new tweet is received in the stream. A full tweet object is sent as the first argument, see Twitter's documentation for what such an object looks like.
- skip count - triggered when Twitter has skipped some tweets in its stream due to high volume. The amount of tweets skipped is sent as the first argument.
Currently supported message types
Twitter's streaming API contains many message types, these are the ones that are currently supported:
- warning (barely supported, will emit custom warning to the console)
- delete (barely supported, will emit custom warning to the console)
Non-supported message types will result in warnings being written to the console.
Possible future features
- More message types
- More events
- Fixed a tiny debug thing that broke 0.3.4
- Added new closeStream() method to enable graceful shutdowns - which is useful at eg. Heroku
- Fixed bug with replacing old connections with new ones
- Made it possible to initiate the stream without starting it
- Removed unused modules that were still loaded
- Moved to OAuth for authentication due to changes in the Twitter API
- Corrected a faulty URL for the git-repository in the package.json
- No changelog being tracked for this and prior version, but main changes were related to updating the module to new Node, NPM and Twitter versions.