Skip to content

Instantly share code, notes, and snippets.

@nehalist
Created December 27, 2014 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nehalist/ea3d5654108782ff4b4c to your computer and use it in GitHub Desktop.
Save nehalist/ea3d5654108782ff4b4c to your computer and use it in GitHub Desktop.
var app = require('express')()
, server = require('http').Server(app)
, io = require('socket.io')(server)
, Twit = require('twit');
server.listen(8000);
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
var T = new Twit({
consumer_key: '',
consumer_secret: '',
access_token: '',
access_token_secret: ''
});
io.on('connection', function (socket) {
var stream = T.stream('statuses/filter', { follow: ['503706361'] });
stream.on('tweet', function (tweet) {
socket.emit('tweet', { data: tweet });
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment