iStrategyLabs/node-twitter — Issue #2: SyntaxError: unexpected end of input
Author: tommedema
Created: 2011-12-25 12:48:42+00:00
State: open

I'm running your example, although slightly modified to:

```
var Twitter = require('node-twitter');

var twitterStreamClient = new Twitter.StreamClient(
'X',
'X',
'X',
'X',
);

twitterStreamClient.on('close', function() {
console.log('Connection closed.');
});
twitterStreamClient.on('end', function() {
console.log('End of Line.');
});
twitterStreamClient.on('error', function(error) {
console.log('Error: ' + error.code ? error.code + ' ' + error.message : error.message);
});
twitterStreamClient.on('retweet', function(tweet) {
console.log('RETWEET BY ' + tweet.user.screen_name + ': ' + tweet.text);
});
twitterStreamClient.on('tweet', function(tweet) {
console.log('TWEET BY ' + tweet.user.screen_name + ': ' + tweet.text);
});

twitterStreamClient.start(['$GOOG']);
console.log('now searching for tweets and retweets..');
```

Ran alright on the first run, but on the second I got the following after a while:

```

E:\Workspaces\Javascript\twitterstream>node src/search
now searching for tweets and retweets..

undefined:0

^
SyntaxError: Unexpected end of input
at Object.parse (native)
at [object Object]._requestDidReceiveData (E:\Workspaces\Javascript\twitter
tream\node_modules\node-twitter\lib\StreamClient.js:147:27)
at Request. (E:\Workspaces\Javascript\twitterstream\node_modules
node-twitter\lib\StreamClient.js:125:14)
at Request.emit (events.js:67:17)
at IncomingMessage. (E:\Workspaces\Javascript\twitterstream\node
modules\node-twitter\node_modules\request\main.js:419:16)
at IncomingMessage.emit (events.js:67:17)
at HTTPParser.onBody (http.js:115:23)
at CleartextStream.ondata (http.js:1124:24)
at CleartextStream._push (tls.js:363:27)
at SecurePair.cycle (tls.js:685:20)
```