Search code examples
c#twitterwebsocketwebhookstweetinvi

Tweetinvi slow on receiving tweets? Alternatives?


I am trying to improve the speed of a tweet handler, currently using a tweetInvi FilteredStream, but it takes upwards of 8 seconds from a tweet being posted to it being received as an event on my end (till HandleTweet() gets called).

var stream = _twitterClient.Streams.CreateFilteredStream();
stream.AddFollow(config.accountIdToTrack);

stream.MatchingTweetReceived += (sender, eventReceived) =>
            HandleTweet(eventReceived.Tweet);

Is there any way to improve this speed? Since currently its faster for me to manually REST call user's latest tweets and see if anything changes every 3-4 seconds or so..

Wouldn't mind any alternatives either.


Solution

  • Tweetinvi opens a socket with the Twitter Stream Endpoint. It means that any delay (apart from network latency) will come from when Twitter manages to analyse the event and send it back to its streams.