Understanding the twitch extension architecture

Extension PubSub is separate from the general Twitch PubSub. On your server you would use the Send Extension PubSub Message API endpoint. That reference also includes the links on how to sign the JWT that will be used.

There’s no way to retrieve historical messages, so your options would be to either have the viewers Extension be in a ‘loading’ state until it receives a broadcast from your server (which could mean sending broadcasts even if the data hasn’t changed, just to update any new viewers).

Alternatively you could maintain the current state on your server, and have the viewer make a single HTTPS request to your server, which would then verify the JWT from the user (to ensure it’s legitimate Extension traffic, and to see what channel they’re viewing on) and then respond with the most recent data for the channel they’re watching.

There’s pro’s and cons to both methods, as the latter would be more responsive as the user isn’t waiting for a broadcast, but the downside being your server would have to listening for incoming requests from users, and during a raid, or a high profile streamer going live with your extension, this can potentially be a large flood of traffic in a short space of time where as if they just wait for the next broadcast message on PubSub only the streamers will be connected to your server, not viewers.