Is anyone else trying to track how long individual users watch your stream? I’m curious what kind of best practices people have found. The big concern I have is how reliable and timely the JOIN and PART events are, and if I should just poll the tmi.twitch.tv/group/user/:username/chatters endpoint.
Also, is that user/:username/chatters undocumented? I can’t find it in github.com/justintv/Twitch-API.
You can’t rely on Join/part aside from the fact that join/parts are batched up into once per say 15 seconds.
They don’t work at all above 1k chatters in chat.
Most people will use the undocumented API you mentioned.
JOIN/PART/MODE events are unreliable because (1) once a stream chat reaches 1k chatters the batched events stop being sent and (2) the batched events are still funky as some users that have not left the chat will, at times, be reported as having done so.
As far as the endpoint you specified is concerned, it is undocumented and suffers from the same issues as the batched IRC events. Its simply a web endpoint to an (internal) list used when compiling the batched JOIN/PART/MODE events; simply put if an IRC client were to maintain a list of who is in a stream’s chat via IRC standardized events it would end up with an identical list that the specified endpoint refers to.
With that said, I use a mixture of methods when tracking a user’s time spent in a specific streams chat; though once a stream hits 1k chatters, the methods break done to non-usable.
(1) Monitor the JOIN/PART events; this gives a baseline for who is in the chat, but is not entirely accurate.
(2) Any user that speaks is assumed to be in the chat for the next two cycles of batch events.
(3) Any user that is assumed to be in the chat but, after two batch cycles*, has not resulted in a join event is assumed to have left the chat.
*: This is two sets of batchevents with the user being considered idle(no events received for the user) in the stream’s chat
@SReject: you say that the …/chatters endpoint is the same as JOIN/PART/MODE, but that would mean that if a channel has more than 1k viewers, then …/chatters should return an empty or truncated viewers list. But I just went to twitch.tv, found a channel with 25k+ viewers (amazhs), and hit up the …/chatters endpoint, and I got a viewers list with 18k+ viewers listed.
This must have changed recently, as previously, if a chat had more than 1k viewers the web endpoint from above would return an empty object:
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.