I'm setting up a node.js twitter streaming app on heroku. It works perfectly until a second client makes a connection. This is something I wasn't expecting until I showed it to someone :(
I am using tweet-pipe for the Twitter Stram API functionality: https://github.com/peeinears/tweet-pipe
To get Socket.IO working on Heroku I followed these instructions: https://devcenter.heroku.com/articles/using-socket-io-with-node-js-on-heroku
io.configure(function () {
io.set("transports", ["xhr-polling"]);
io.set("polling duration", 10);
});
In my app.js file I have
io.sockets.on('connection', function (socket) {
tp.stream('statuses/filter', params, false, function (stream) {
stream.on('tweet', function (tweet) {
socket.emit('tweet', tweet );
});
});
});
Again, this all works great until another client visits the page. Then the original connection is lost while the second client has a connection. Any thoughts? I'm a little new to the Socket.IO stuff.