0

I need to write the code responsible for notifications about the release of a new tweet from a specific user. Here is my code:

var userClient = new TwitterClient(consumerKey, consumerSecret, accessToken, accessTokenSecret);
    
long userId = id;
    
var stream = userClient.Streams.CreateFilteredStream();
    
stream.AddFollow(userId);
    
stream.MatchingTweetReceived += (sender, args) =>
{
    Console.WriteLine("New Tweet");
};
//Tweetinvi.Exceptions.TwitterException: "Stream cannot be read." code -1
await stream.StartMatchingAllConditionsAsync();

In the console, I get a notification:

An error has occurred: Reason: The stream cannot be read. Code : -1

I tried to change the authentication keys, but it didn't help, it gave another error related to endpoints that I don't have access to. To be honest, it seems to me that the problem is in the application settings in the API, but I don't know exactly what it is, I've tried a lot, but I haven't come to what the problem is. In general, I think there are no problems in the code.

Adalyat Nazirov
  • 1,611
  • 2
  • 14
  • 28

0 Answers0