How often does the twitch api send back JOIN alerts?

I’ve coded a bot in python and I’d like to run some background code when a user enters the channel (they don’t necessarily have to type anything in chat). I’ve noticed that I’ll get JOIN messages a bit later (anywhere from 10 seconds to about a minute) than the user actually joins the channel, is this normal? I know the API documentation states that it sends out an alert every few seconds, which is fine, but 1 minute+ seems a bit too long

JOIN messages are not a reliable way to monitor/track users as some user JOINs are never sent (more so in higher traffic chats, and I think beyond 1000 it just stops completely, can’t quite recall for that one though.)

So, you can still choose to watch for JOIN’s but its not reliable.

In that case, do you know of anything more reliable that I could use? I’m attempting to implement a currency system in the bot, and obviously I’d want it to start tracking as soon as a user enters the chat, then stop when they leave, the first thing that I thought of was using the JOIN and PART notifications.

You could poll at a set interval to check for changes (new names)
It’s not necessarily faster than listening for JOIN but it’s reliable.

As @sundheden has said, the endpoint would probably be best, but its important to keep in mind that since it is not part of the Kraken API, I believe this is not a official/supported endpoint and may be subject to change at any time.

TMI is also cached, which means that it is not a live representation of the channel either. I am not sure how far behind it is, but I recall that it was not in perfect sync with chat when I was using that particular endpoint.

Regarding the 1,000 users, that could be the NAMES command that is being thought of that Twitch says after 1,000 users will only return OP users.

Although the others have given enough information, I recommend checking out pre-made libraries such as asynctwitch which make stuff like this quite a lot easier

1 Like

You’ve all been a great help! :smiley:

I’m definitely going to do a bit more research into this to see what I can dig up

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.