Detect when viewer leaves channel / amount of time watching

We’re developing an extension that rewards users based on amount of time watching the streamer.

The chatbot will tell us when a user joins, but doesn’t appear to tell us when they leave - so that will not work.

Does anybody know of a good solution to track the amount of time that a viewer is watching a stream w/ our extension? (without the viewer client pinging our backend every X minutes in order to track)

I found this topic which I believe is asking for the same thing but has been closed with no answer, so just seeing if there’s been any update around this.

Thank you in advance!

The simple answer is there isn’t. The next answer not is there will soon be a chatters API endpoint which will be just what you are looking for and won’t need to use chat.

Side note the join notification stops once 1000 users are in chat ( I believe it’s 1000)

1 Like

All that there is to use, which is what almost all ‘points’ systems use, is the undocumented chatters endpoint: http://tmi.twitch.tv/group/user/CHANNEL_NAME/chatters

It’s not without issues though, the endpoint has issues more frequently that official endpoints, and most importantly it’s a list of people connected to chat, it’ll include bots, and users who aren’t even watching the stream, and will also miss anyone who’s watching from an embed or has chat disabled. It’s the best we got though and for some use cases has sufficient accuracy.

The new roadmap mentions Chatters, so hopefully we will be getting a documented and more reliable (and hopefully more data returned) endpoint in the future, but it will still likely just be a list of those in chat and still not count for viewers.

Many of us have brought up a VHS endpoint that’s for a channel rather than a game, which with appropriate scopes could be huge, but sadly no mention of if anything like that is on the table.

1 Like

Thank you. That’s huge to know regarding the 1000 limit.

Thanks so much, Dist. I’ll look into chatters, but its starting to seem like we’ll need to implement out own solution.

We all use that ^^

2 Likes

That is weird, though, as when you’re connected via the IRCish interface you get JOINS as well as PARTs when someone leaves again.

I’m using those myself and up until now they worked fine.