API Stream KO...or not


#1

Hi,
I use the API to stream across the client twitter for nodejs. This works well and that for some months. I am in testing and I receive tweets from my account.
For whatever reason the last few days, it happens that the API does not detect a tweet sent. Some time later without change in my code, it will start working again. As if the API was broken or when I was blacklisted.
Yet I received no message from twitter in this direction.
Does anyone have an explanation for the random behavior of the API for some time?
For information, I’ve even used the API with Apigee and I had the same lack of results so it is not from the code but the API.
Thanks for some advice.


#2

Can you be more specific please? this is very hard to diagnose based on your post. Code or query examples?


#3
var client;

Twitter.streamTwitter = function() {
	client = new Twitter({
		"consumer_key": process.env.TWITTER_CONSUMER_KEY,
		"consumer_secret": process.env.TWITTER_CONSUMER_SECRET,
		"access_token_key": process.env.TWITTER_ACCESS_TOKEN_KEY,
		"access_token_secret": process.env.TWITTER_ACCESS_TOKEN_SECRET
	});

	var stream = client.stream('statuses/filter', {track: 'XXXXX'});  // where XXXXX is the keyword i looking for

	stream.on('data', function(tweetReceived) {
		console.log(tweetReceived);
	});

	stream.on('error', function(error) {
		throw error;
	});
}

This code work sometimes, and some over time not :slight_smile: For example this night, it’s work and one hour after without touch any code it doesn’t work.
This code is in a worker nodejs for multithreating.
The only answer i see is that twitter banned me because i have more than one connection by ip. But this code is launch one time and listen indefinitely.
Thanks for your answer by the way.


#4

Is anybody have an idea ?
Is twiter send you a mail or something when y’ou’re ban ?
How can i know if i’m ban from API ?
Thxs for any advice :wink:


#5

If you have a connection to the API the by definition your IP is not blocked. You should not attempt to make multiple streaming connections from a single machine. If you do then they will be cut off.