Twit + Socket.io
Hi,
I am facing the same issue like https://github.com/ttezel/twit/issues/89 & https://github.com/ttezel/twit/issues/74
Tried a lot of things but nothing seems to work. Can anyone help?
The event listener for on 'tweet' does not fire. Apart from that, when logging the msg from parser.js, it simply returns blanks lines.
Also, the stream does not stop. The disconnect event fires but the stream won't stop
Can someone help please?
The code looks something like this:
https://gist.github.com/nambad/d7e5f1f90935bba87e40
Just keep blank messages from twitter when sending the parameters by socket.io If the function startstream is called directly, it will work perfectly fine.
You shouldn't create more than one twitter stream at a time from a single set of account credentials. It looks like you're creating two instances (not sure what the twitter class is in your code but it looks like you're creating at least one twit instance per connection per startstream (which will be a LOT of twit instances). Twit will fire disconnect events because Twitter will tell us to disconnect since we have more than one stream open. Twit will only reconnect and keep the stream going if Twitter tells us it's okay (eg. we get rate limited but we are still allowed to reconnect), and will close the stream if Twitter tells us to disconnect. It looks like what's happenening is you keep creating streams and they will disconnect and different intervals.
Basically, don't ever have more than one stream open at a time to Twitter with a single set of account credentials. Any situation where you do that won't work - Twitter will disconnect you. If you want more than one stream open at a time, you need more sets of credentials.
No. The code accepts the account as a parameter. So for every stream, a different account is used. The problem is no tweets are received. Other case, the stream.close() is not working. It deletes the stream object but I can still see the data coming through by adding a console log in parser.
The stream gets connected but does not emit anything. It simply emits blank lines. But calling the function directly, it will call the data.
Also, since the stream is not closing, and when attempting to connect with the same credentials after sometime, an error is fired saying "Exceeded number of connections for this user" in plain text and not a JSON format
Stream closing can be tested with the attached code:
https://gist.github.com/nambad/02ecabc35aa54e681a0b
the twitter class is the twit object. Apologies for the confusion
If you're still having issues with this please reopen the issue! Run npm update twit to try it with the latest version. Thanks!