Getting view count

I can get the view count by making a GET request to https://api.twitch.tv/helix/streams, but I’m looking for a way to get an updated view count as it changes. I don’t really want to make anither GET request on an interval.
I’ve traversed the docs, but neither the pubsub api or the helix webhook api has anything to offer.

I’ve found an undocumented pubsub topic under the name video-playback-by-id.some-id, however I’m not sure how Twitch views the use of undocumented APIs.
Any inputs on this?

Polling the streams endpoint is the correct way to get the current view count. Because of caching you should limit polling to around once per minute or slower.

The stream changed webhook topic intentionally does not send notifications for viewer count changes, as this is a design choice by Twitch.

Use of undocumented endpoints can and will break/change at any time and without prior warning, and this does happen from time to time so general advice is don’t use undocumented pubsub topics for anything critical or long lasting.

And you can only subscribe to so many topics on pubsub.

So your best bet is to poll the API every minute.

Alright thanks! It just seems weird to poll the API every so often, but oh well.

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