You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When it runs, it connects to the stream but after a few seconds, it closes the connection and schedules a reconnect. Eventually I get throttled by Twitter. The reconnect is called by this stacktrace (I got it by adding console.trace('scheduling reconnect for ' + self._connectInterval) to StreamingAPIConnection.prototype._scheduleReconnect):
Trace: scheduling reconnect for 0
at StreamingAPIConnection._scheduleReconnect (/home/conrado/workspace/quiriquiri/node_modules/twit/lib/streaming-api-connection.js:269:11)
at StreamingAPIConnection._onClose (/home/conrado/workspace/quiriquiri/node_modules/twit/lib/streaming-api-connection.js:174:8)
at emitNone (events.js:67:13)
at Request.emit (events.js:166:7)
at Gunzip.<anonymous> (/home/conrado/workspace/quiriquiri/node_modules/twit/node_modules/request/request.js:974:51)
at emitNone (events.js:72:20)
at Gunzip.emit (events.js:166:7)
at emitCloseNT (zlib.js:471:8)
at nextTickCallbackWith1Arg (node.js:430:9)
at process._tickCallback (node.js:352:17)
However, if I change the code to this:
varT=newTwit({consumer_key: secret["consumer_key"],consumer_secret: secret["consumer_secret"],access_token: secret["access_token"],access_token_secret: secret["access_token_secret"],timeout_ms: 60*1000,// optional HTTP request timeout to apply to all requests.})varstream=T.stream('user')stream.on('message',function(tweet){console.log('message: '+JSON.stringify(tweet,null,4))})
It works! It seems it only happens when I instantiate Twit inside a class. (If I instantiate it outside the class and put it in the class attribute, it also works, e.g. user.twit = T)
Does anyone have any idea what's going on?
The text was updated successfully, but these errors were encountered:
This is a very weird behaviour. See this example (seems artificial, but it's the minimal working example):
When it runs, it connects to the stream but after a few seconds, it closes the connection and schedules a reconnect. Eventually I get throttled by Twitter. The reconnect is called by this stacktrace (I got it by adding
console.trace('scheduling reconnect for ' + self._connectInterval)
toStreamingAPIConnection.prototype._scheduleReconnect
):However, if I change the code to this:
It works! It seems it only happens when I instantiate Twit inside a class. (If I instantiate it outside the class and put it in the class attribute, it also works, e.g.
user.twit = T
)Does anyone have any idea what's going on?
The text was updated successfully, but these errors were encountered: