Twitch API: Keeping Data Updated Without Reload Of Page


Although this isent specific to Twitch, it’s something i’d like to do with Twitch API.

I have my json object i am decoding and then im printing out the array. I’d like for the data to automatically update on the page. How can i do this. For example the viewer count automatically updates, without reloading/refreshing the page.


If you’re loading it with JavaScript, you could simply fetch it on an interval, using setInterval.

Ahh, that makes sense.

I am getting it via PHP.

Is there a any other downside of getting api data which comes from json files via PHP, which java script could handle better.

Getting it on your server only to send it to a client costs bandwidth and server power/time for you.
Instead of letting the user load and handle the data, your server uses bandwidth to download the json. As well as using server cpu time to parse JSON and render HTML.