Getting broadcaster live status

I’m wondering if there is a way to be notified in my extension when broadcaster starts and stop a stream.

If I’m not wrong I can check at startup if it is actually in live streaming calling Twitch API:

If the response is empty I can assume it is offline, otherwise is online

After that I can send HTTP POST to EventSub for stream.online to be notified in real time of status changed:

Is this ok or is there some option in Twitch Extension Helper that I’m missing?

Helix JWT + call the Get Streams API

Or if you extension is in the overlay or component slots it can only be loaded whilst the channel is live anyway

it is impractical for an extension front end to do this, so no.

I assume you want the frontend to know without a backend due to

I see, my extension is in panel too due to slot limited in component, so in panel if I load the broadcaster page and is offline then I should start polling the same api to check if broadcaster started a stream

What is your requirement/use case for needing to know if the stream is live or not?

Then I can recommend what is more optimal

My extension is a viewer engagement so I’d like to show a “offline” status page if some1 open broadcaster page and he/she is offline, but if a stream starts it should reload itself to show “online” page. Right now viewer needs to reload the page to let extension show the online part

Then you probably only need to process onContext as that’ll send live data calls, or use helixToken as directed in my response.

Alternativelly make the call to your server and the server can do the relevant calls to see if the channel is live or not.