Is it possible the viewer to use send()?

I am trying to create a panel Extension where the viewer(s) can press a button and the streamer, via the live config panel, can see what buttons are being pressed.

To do this, I am using:

window.Twitch.ext.send("broadcast", "string", "test message");

which fires when the viewer clicks the button.

On the live config I have:

window.Twitch.ext.listen("broadcast", function (data, type, message) {
  // Do stuff
});

Unfortunately, when the viewer tries to send, this is failing with a 403 and the response message reads

Permission denied to use target

I have also tried with whispers in place of “broadcast” and get the same response.

Is it the case that this simply isn’t possible without a trip to my EBS? Given that listen() and send() both already exist on Twitch’s end I had assumed it would be a case of just linking into these.

Thanks

Only broadcasters get the send permission by default provided in the JWT that onAuthorized sends. And if you think about the Twitch PubSub restrictions, it makes sense: 1 message per second per channel

If your viewers were sending PubSub messages, it would quickly overcome this restriction.

I suspected as much, but thought it was worth checking! Your explanation makes a lot of sense - thanks for the clarification. Time to learn how this whole EBS thing works…

Rather than send via the JWT helper, you make a GET/POST call to your server.

Then your server can queue messages and relay them to Twitch PUBSUB.

In a nutshell.

How you do the send, is up to you. GET/POST is easier (jQuery.ajax for example) but you could use websockets

1 Like