xonecas.io
49
Do

dotter / commit 861ec14

trying to figure out a way to trace replies/get around twitter limits on requests

xonecas2011-02-06 861ec140f50f0471496eb876cc7cf067b893d50a parent 5fc1424

1 file changed

server.js+8−1
@@ -25,6 +25,7 @@ server.listen(1234);
2525 var stream = false;
2626 var socket = io.listen(server);
2727
28+//var debug = 10;
2829 socket.on('connection', function (client) {
2930 if (!stream) {
3031 twitter.stream('statuses/filter', {locations: '-180,-90,180,90'},
@@ -35,6 +36,12 @@ socket.on('connection', function (client) {
3536 console.log('===== New stream started =====');
3637
3738 stream.on('data', function (twiit) {
39+/*
40+ if (debug) {
41+ console.log(sys.inspect(twiit));
42+ debug--;
43+ }
44+*/
3845
3946 var geo = twiit.geo,
4047 coords = twiit.coordinates;
@@ -55,7 +62,7 @@ socket.on('connection', function (client) {
5562 }
5663
5764 client.on('disconnect', function () {
58- if (_.size(socket.clients === 0)) {
65+ if (_.size(socket.clients) === 1) {
5966 stream.destroy();
6067 stream = false;
6168 console.log('===== Stream destroyed, idle =====');