Hey Aryak,
You haven't mentioned if watchList is global/common for each client or at the
time of connection client is submitting its own watchList?
If your watchList is common between all clients then you need to write your
sample code such that it executes only once. E.g.
var io = require('socket.io')(80);
var stream = T.stream('statuses/filter', { track: watchList })
stream.on('tweet', function (tweet { io.emit('stream',tweet.text);
});
});
io.on('connection', function(socket){
// nothing.
});
But if client is submitting its own watchList then approach is different. In
that case instead of writing io.emit you should emit to only client. Below is
sample code for that.
var io = require('socket.io')(80);
io.on('connection', function(socket){
socket.on('watchList', function(watchList){
var stream = T.stream('statuses/filter', { track: watchList });
stream.on('tweet', function (tweet) { socket.emit('stream',tweet.text);
});
});
});
});
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/54790e42-0dd3-43b3-bce0-6bf7055e47ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.