justintv / Twitch-API

A home for details about our API
www.twitch.tv
1.72k stars 381 forks source link

Are there plans to release real-time endpoints? #593

Open dagumak opened 7 years ago

dagumak commented 7 years ago

The whole theme for Twitch is about live streaming video games. Time is the most important criteria in live streaming. I think we can all agree in the difference that a few seconds can make. Now, based on the answers in past issues here and based on my experience with playing around with the API, the caching on the endpoints pop in 30-60 minutes. It's notably faster on the streams endpoints (a few minutes or less), but still slow given the nature of the data. The caching makes it very difficult (if not, impossible) to build a meaningful application center around the idea of live streaming AKA real-time. I do understand the importance of caching and normally I would for it, but the cached invalidation timeframes does not seem very reasonable in a time sensitive API.

With that said, are there plans for real-time endpoints?

freaktechnik commented 7 years ago

You mean like the PubSub system? That's about as real-time as you'll get.

dagumak commented 7 years ago

@freaktechnik I'm looking at the documentation, but perhaps I am missing it, so correct me if I am wrong. It seems that the Pubsub portion is only related to the chat and video. For example and among other things, what about followers?

freaktechnik commented 7 years ago

I am not talking about the content, as Twitch clearly stated that the PubSub will be expanded in the future where they see fit (which I assume will include subscriber and follower info, as that's a popular polling target), instead I am asking if that's the kind of real-time you are looking for.

dagumak commented 7 years ago

@freaktechnik PubSub is great, but overkill for me. I'm happy with just an endpoint where I can keep polling for updates. Some of YouTube's API endpoints return new data every second I poll, and I was expecting a similar result here as well.

ghost commented 7 years ago

Pub Sub is never overkill. You should be using endpoints for history data, and pub sub for live activity and (slow, slow polling) to make sure you didn't miss anyone.

For example:

This way you're minimizing your footprint on the twitch api while still maintaining high quality records - Some applications can require a full rescan of subscribers instead of working with the archived files but in general those are not normal use cases.

Also, speaking from experience in working with youtube apis, you're not getting uncached data from api endpoints every second. There's some low cached endpoints when videos have < 300 views, but it changes to daily aggregates after that.