(Swift Developers) How do you check if someone is online or not?

I’ve been racking my brain on this for a while and cannot seem to find an answer can anyone help me? How do you check if someone is online or not?

While I don’t know for the progamming language Swift, you would check if there is any data/objects in the 'stream' token at the link: “https://api.twitch.tv/kraken/streams/CHANNELNAME?client_id=CLIENTID

Two examples below, notice how the ‘stream’ token is null in the offline user but it contains data for the user who is streaming.

Example of user who is not live:


Example of user who is live:

{"stream":{"_id":23808949568,"game":"Hearthstone: Heroes of Warcraft","viewers":3756,"created_at":"2016-12-01T16:54:04Z","video_height":720,"average_fps":60,"delay":0,"is_playlist":false,"....and so on, much more data is shown in real-time.

Hopefully this helps! (if you were looking for a Swift-specific answer on how to make an api call, then sorry! Maybe this Stackoverflow link will help?)

thanks for the quick reply

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