Preferably in a way that would work in an HTML page, like how TMI.js does in websockets. (Still don’t know why there isn’t a follow event).
If not that, a way that would work in Node.js would be OK. From what I’ve seen in my research, the Twitch API endpoint for followers only updates every minute or so, but I’d like followers to get immediate recognition.
The API can’t be the only way, can it? It’d be rather silly if you could get everything BUT followers from TMI.js. I don’t know why there isn’t an option for this anyways, it seems to be highly requested.
I was not aware that TMI.js was a third party script, but even then, its namesake is Twitch’s own service, which begs the question of why Twitch would offer everything BUT follower notifications through TMI? I feel giving follower alerters the option to receive follower notifications as they come is a far better alternative than having thousands of streamers polling the API for 25-100 followers at a time when they really only need the latest ones. Imagine smaller streams needlessly polling the API for followers when there is a new follower every hour or two. Inefficient if you ask me.
Polling the API is small multiple bursts of network and processing. Opening a websocket would require a constant and good connection, while it would be constantly checking if it needs to send or if it received a message. Therefore, it takes less resources to continue their current method. And so far everything is quick enough. Usually the delay in a notification comes from the actual stream delay, not nessicarily the API.
True, but most streamers already have bots that use TMI.
This means they have bots that are polling TMI AND software that polls the API for new followers. Constantly. It would make sense to at least offer the option.
Chat is never 100% reliable though, there are times when there are disconnections or events not quite working so bots that announce new followers would likely still poll the API anyway as for whatever reason if an event in chat is missed, it’s not repeated, where as if an API call fails, the new followers will still be there shown on the next successful request.
That still doesn’t answer why TMI doesn’t support followers. If you’d rather use the API, fine, but I don’t see why that choice should be the limiting factor. If TMI is inconvenient to Twitch, I don’t see why they’d keep it around.
I don’t want to develop software that has to run on both APIs if it doesn’t need to, it just seems rather silly that Twitch would implement so much functionality into TMI, but skip follower support and point people to the API. I don’t need the last 25 followers, I need them as they come, and I already use TMI in my bot.
There’s no real reason I can see to not trigger a follower event on a service that Twitch has already implemented and supports, and that most streamers already use. If TMI is buggy, that’s not a reason to not trigger a follower event, it just means Twitch has some work to do with TMI.
I’ve only been at Twitch a year, so I don’t have full context. My understanding is that feature-related functionality was added to TMI when needed to support chat and chat rendering on the site. E.g. Subscribers, badges, and Bits all show in chat in some way. Followers do not show in chat, so they weren’t added to TMI. They were added to a REST endpoint instead.
You say there’s ‘no real reason’ not to trigger a follower event, but at the same time is their sufficient need? Hundreds, if not thousands, of streamers using follower notifications in one form or another that is perfectly suitable for the needs of themselves as streamers and for the value it provides their viewers. As of right now, polling the API does the job and I’d rather Twitch spend development time working on more important areas than an additional implementation of something that is already possible, it just happens to be in a different form that you would like.
I explained that there is indeed real reason. The majority of Twitch streamers use a bot that connects to TMI or IRC. The majority of Twitch streamers additionally poll the API for followers
It could reduce traffic on the API, and eliminate it entirely for some streamers, particularly if they only need follower notifications from the API and nothing else.
The system works as it is, correct, but that doesn’t mean there isn’t room for improvement.
I also don’t think it would require much work to trigger a follower event. I’m not Twitch staff, so take that with a grain of salt, but TMI already seems to trigger events for subscribers and a lot of other things. Intuition would suggest that it wouldn’t be much work to incorporate followers to that list.
DallasNChains makes a good point that there isn’t a follower message in chat. However, I feel the introduction of follower events to TMI and the proper proliferation of using it as the primary way of receiving follower updates would reduce traffic on the API and enable quicker follower alerts to boot.
While polling the API is still the more reliable (and in most cases more sensible) option, follower events in TMI would make sense now that the follower only mode exists. It would allow moderators (or everyone) to be shown when new people are able to chat.
TMI is IRC. One and the same. TMI (Twitch Messaging Interface) has a IRC compatible endpoint.
It doesn’t make sense to have followers in TMI as TMI deals with chat, the delivery of chat, and anything related to displaying chat on the Twitch website.
Personally makes more sense to put follower notifications into PubSub. But the ONLY thing that having follower notifications here is for third party, it wouldn’t be used on Twitch’s “core” product(s). That being chat and video. So don’t hold your breath.
I and everyone else don’t have a problem long polling a cached end point.
Your use case @phosphorcat is not more “real” as a reason than the existing solutions cover.
Moving (or providing) something like this to a PubSub or TMI level interface is way more “expensive”, given people like to spam follow/unfollow streams anyway [metrics needed], so getting those notifications thru the stack (reliably) is way more expensive given it has to be multi user/consumer safe across thousands of channels.
Basically, it’s not simple as you think it is, and it’s way better/safer/cheaper to deliver a the same page of data over and over again to a consumer refreshing the page than thinking about and choosing to deliver a notification over the events stack.
As to your suggestion about “quicker follower alerts”, 3 minutes which is about the “average” delay due to edge side caching is perfectly fine, for most applications, which last time I checked was what followers was trundling at.