From the code snippet you provided, it appears like you’re hitting the /channels/<channel-id> endpoint. To check whether or not someone is online, use the /streams/<channel-id> endpoint. If a stream is offline, the stream object in the response will be null.