Follow event is not firing after connecting to user stream



Hi there,

I am using a Twit client to monitor when a user gets followed by another account. I am connecting to a user stream in order to receive follow events and it works fine most of the time; however, I have noticed that if I open a user stream and another account follows my user shortly after (less than a minute), sometimes the follow event is not received by the Twit client.

I haven’t been able to figure out the cause of this problem and how to fix it. I am curious whether this problem could be caused by a time span that needs to pass from opening a user stream until follow events can be received?



Yes, that (timing) is a possible explanation. The user streams API is not necessarily high-reliability. Technically, it could be that you connect to one instance of the streaming backend but the events are not propagated across our infrastructure completely synchronously so an initial / immediate follow might seem to be “dropped”.

The user streams API will be replaced by the Account Activity API (now in beta) in the future.