I am trying to stream tweets to the client and everything works fine, as long as there is only one connection. If I am am streaming tweets in one tab of my browser and open the page up in a new tab, the first tab will stop receiving the new tweets and only the second tab will receive them.
Server code.
io.sockets.on('connection', function (socket) {
var twitter = require('ntwitter'),
util = require('util'),
twit = new twitter({
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: ''
});
twit.stream('statuses/filter', {'locations':'-124.46, 24.31, -66.57, 49.23'},
function(stream) {
stream.on('data', function (data) {
data.geo ? socket.emit('twitter', data) : ''
});
});
Client code:
var socket = io.connect()
socket.on('twitter', function (data) {
//Do really awesome things.
});
What am I doing wrong? It has to be simple. I can't imagine its this hard to support multiple connections.
Cheers