After I found out that the rig is completely useless for testing because most of the things I try to do aren’t working, I decided to test without the rig. But in the documentation I didn’t find anything how to test without the rig. I know that I have to setup a server which hosts my files but what then? How can I test it afterwards? In the rig i could create views to check how everything is working but how do I do it without the rig?
You install the extension to a channel
And view it on twitch instead of in the rig.
The rig will spin up a server to hosts files for you.
But you can use a server with the rig anywau.
Hosting an extension is technically identical to hosting a website.
Since an extension is jsut a website.
The only thing you need to test on Twitch instead of in the rig, is you need some real SSL certs to prevent mixed content issues.
So to view an extension on Twitch just install and activate it to slot, just like you would a released extension.
And to view a vidoe extension (either overlay or component) the target channel needs to be live.
Ok thanks. How do I get a SSL certificate for testing and where do I need to put it?
There are a few ways to get a SSL cert for testing.
These work for a “real domain name”
- Buy one
- get one with your hosting
- get one from Lets Encrypt or other free cert provide
Depends on how you are hosting. What server type you are using/etc
Follow those instructions
Ok I know let’s encrypt, I have setup a simple http server with node npm install -g http-server like in the extension tutorial.
Ok now I don’t know how to get the certificate from certbot, it’s a while ago since I last used it. There are options on the website to choose which server and what system, what do I need to input there? I don’t know what kind of server the node http-server is opening.
Personally I don’t put my certs into node.
I setup my test environment to more closely match Twitch.
So I SSL terminate my front end test (and EBS) with nginx and proxy pass to node.
Then node doesn’t have to faff about with certs.
Also you don’t have to use node to serve your files.
I wrote about my methods on part 5 of my extension blog series Twitch Extensions Part 5 – Dev Environment – Barry Carlyon
Yeah but what you writing in your Tutorial is a bit over the needs of my simple project.
It’s so dumb that I need all that knowledge of how to setting up servers and getting SSL certs and in the documentation they say all you need is knowledge of css, html and JavaScript.
That is simply not true, if I need to test my extension, which everyone needs to, I do need exactly that kind of server knowledge because so many things aren’t working when using the rig.
You can upload your files to hosted test and test that way instead. Granted to make a change your have to go back to local test and then reupload a new zip, which is what you would do if you were uploading to a “real” website host.
The bare minimum is HTML/JS/CSS.
Knowing something about servers is useful so you can improve your test environemnt and/or provide an EBS.
EBS being a backend API that your extension might need and that will need SSL too, which might be handled by a hosting provider.
You can host your extension for testing on a “real website” just like a real website and then you are just uploading files to a shared host/whatever hosting, just like a real website.
So yes the minimum you need to know is HTML, JS and css. As an extension works just like a “real website” as essentially it is just just a website.
So you can upload your extension to a “regular” website host and use that URL in your testing base URI.
One of my test extensions even uses GitHub pages to run the hosting. So GitHub handles the hosting and SSL for me, for example.
So you have options on how to deplay you extension/website/files for testing with.
You don’t need any server knowledge if you are using a hosting provider.
Edit: and as noted in my blog post, you can use ngrok to SSL termiante and tunnel to your node http-server and then ngrok handles SSL and making your extension “world accessble” if you need to test with other people (prior to hosted testing)
Because of the configuration service which allows me to store simple data, I thought I didn’t need an EBS. If I switch to hosted test, can I simply reupload my packaged zip file if I need to change something?
That is one use of the config service yes.
Since it can be set by a broadcaster JWT via the JS helper.
Yes.
You can move from hosted ttest to local test back and forth as much as you want.
Can I also write data to the configuration service if a viewer performs some action?
Yes and no.
The viewers JWT doesn’t have write access.
But you could in theory recieve the viewers action somehow in an open broadcasters view.
And then write to the config service.
This isn’t ideal and a EBS would be preferential.
There are a lot of security implications here, hence the viewers JWT cannot write to the config service.
Without a server it’s a clusterfuck to do it and involves too much over head from the broadcaster.
If you have an EBS or some sort of backend service then you can do what you need to do securely.
Let’s say a viewer is spending bits, is it possible to somehow send a message to the broadcaster through pubsub with the information who was spending and how much?
A users JWT cannot broadcast to extension pubsub.
However if the product is set to “broadcast”
Then it’s broadcast to all instances of the extension regardless of the person that initiated the transaction.
So if the broadcaster has a view open then yes the broadcaster could recieve it.
However optimally you’d be using a server to handle this sort of flow. to account for the broadcaster “oh I forgot to open a window” and audit loggin
See onTransactionComplete
under Reference | Twitch Developers with initiator
and more specifically Monetization | Twitch Developers
Oh man that’s bad, all I need is a simple Json file and some logic to read and write to/from it. Seems that I really need some kind of EBS to serve my needs. I was hoping that I could overcome this issue with the configuration service.
You could but it would be too error pronoe
Additionally each segment is limited to 5kb so you might run out of space
It’s also not designed to be written to frequently
Ok so the configuration service is really not the right for my use case. Thanks again for your help. They should really pay you for your effort if they aren’t already.
In your tutorial part 5, you’ve wrote about reversing a ssh tunnel to handle SSL termination. Can you explain the steps a bit more?
I understand how to setup a nodejs server to serve my frontend but I don’t know exactly how to proceed afterwards.
Can I input the ssh command in the cmd? I’m using Windows.
And how can I get the certificate from Let’s Encrypt and where do I need to put it?
Refer to the installation instructions for Lets Encrypt as needed for your system.
And for install refer to the specific instructions for your HTTP server.
Sure CMD should be able to do it.
Persoanlly if I was on windows I’d do it in putty.
I use NGINX.
For Node behind NGINX you would have NGINX and the node thing on the same server.
And configure NGINX ot proxy pass a given domain or path to the port the node thing is running on.
In this case NGINX proxy passes to a port.
Then I SSH in from local, defining a reverse SSH tunnel to that port.
And the node thing runs locally on a port.
So
Nginx Proxy pass to port
Local SSH sets up a tunnel between localport:127.0.0.1:port nginx is proxy passing to
So in the example in part 5 of the blog
Nginx is proxy passing to 127.0.0.1:8050
There is no node thing on that server listening to 8050
So on my local maching. I would usually setup the node thing to listen on 8050
And then i run
ssh -R 8050:127.0.0.1:8050 username@example.com
Which tne setups up 127.0.0.1:8050
to be routed over the SSH tunnel to 127.0.0.1:8050
on the local machine.
This is basically what NGROK does for you in a single command on a random URL.