snapkite-stream-client
v1.0.3
Published
Stream client for Snapkite Engine.
Downloads
40
Readme
Snapkite Stream Client
This helper library handles stream of tweets sent using Socket.IO by Snapkite Engine.
Install
npm install --save snapkite-stream-clientAPI
var SnapkiteStreamClient = require('snapkite-stream-client');initializeStream() or initialiseStream()
Connects to Snapkite Engine and invokes callback function on receiving new tweet:
SnapkiteStreamClient.initializeStream(callback, options);Callback function should handle tweet object:
function callback(tweet) {
// ... handle tweet object
}options object:
{
hostname: 'localhost',
port: 3000,
delayInMilliseconds: 1500,
cacheNumberOfTweets: 20
}hostnameDefault:
localhost.portDefault:
3000.delayInMillisecondsTweets can arrive at a very fast pace, so to prevent that you can set the minimum delay between tweets. Delay is set in milliseconds.
Default:
1500cacheNumberOfTweetsIf you set a delay between receiving new tweets, you might want to cache them. Tweets that are not cached will be dropped.
Default:
20
destroyStream()
Disconnect from Snapkite Engine.
SnapkiteStreamClient.destroyStream();License
This library is released under the MIT license.
This software comes with NO WARRANTY, expressed or implied.
