Communicating with the backend in hosted test

Hi all. I’m trying to make a twitch extension, but I’m new to web development, so it’s pretty difficult getting started. I don’t really understand how the front end communicates with the back end. I’ve read up on signed JWTs and PubSub, but there is a lot of lingering confusion.
Question 1:
If my back end is hosted somewhere does that mean that it is code that is always running, waiting to receive a message from PubSub?

2:
My current short term goal is to make a button in live_config.html change something in viewer.html. Does this actually require PubSub or an EBS? What’s the easiest way to communicate a button press? And if the answer is that I don’t need the back-end here, then what is the EBS actually used for?

3:
Is there example code somewhere of an actually completed extension that I could look through?, because I’m not good enough at this yet to do much with starter code when I find it.

4:
Having read the docs on pubsub, I still don’t really get how to use it. It would be positively radiant if someone has some code lying around that they could post as an example.

Thanks so much if you answer any of my questions. Code snippets are most appreciated :slight_smile:

Depends how you code your extension and backend.

Pubsub technically no
EBS yes.

You don’t have to use pubsub to communicate.

However,

EBS no in theory. You could go completely serverless, but that would mean exposing your extension secret to the world.

But

The EBS is a scenario such as yours, reads in a POST request from the config panel, verifies it and checks the channel about to send to is the right channel for the sending message and then creates a pubsub message, using your extension secret to compose the security component.

A serverless one would likely be rejected due to the exposure of the secrets.

https://github.com/twitchdev/extensions-samples/tree/master/boilerplate here is the boilerplate

The Extension PubSub docs describe how to send messages. It’s a system that you don’t have to use at all. It’s just there if you want it.

All of my code on my public extension deals with relaying a pubsub message from some source, so theres nothing to share aside from a working POST request… Which matches the documentation.

All of the other code is display logic for my messages I send over pubsub.