# Architecture between broadcaster and viewers

**URL:** <https://staging-discuss.dev.twitch.com/t/architecture-between-broadcaster-and-viewers/19889>\
**Category:** API\
**Created:** [February 5, 2019, 7:44pm UTC](https://staging-discuss.dev.twitch.com/t/architecture-between-broadcaster-and-viewers/19889 "2019-02-05T19:44:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![labureta](https://avatars.discourse-cdn.com/v4/letter/l/9fc29f/32.png) [@labureta](https://staging-discuss.dev.twitch.com/u/labureta)\
**Post date:** [February 5, 2019, 7:44pm UTC](https://staging-discuss.dev.twitch.com/t/architecture-between-broadcaster-and-viewers/19889/1 "2019-02-05T19:44:28Z")

</div>

Am confused about the architecture of developing on twitch, all i need to do is interface for the broadcast that allows for settings and other stuff and it sends texts to ALL viewers, where each viewer can disable/enable/customizes few options, a lot like tobi tracker, except its text.  
My question is do I really need to make a dedicated server running a EBS where the broadcaster sends data to that dedicated server then to twitch then viewers?  
Or simply the broadcaster sends data to twitch then to viewers?

How would i go about this?

Thank you!

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [February 5, 2019, 10:48pm UTC](https://staging-discuss.dev.twitch.com/t/architecture-between-broadcaster-and-viewers/19889/2 "2019-02-05T22:48:30Z")

</div>

You could have a config panel on the Twitch dashboard for you extension would could directly post to the Twitch PubSub.

That might work I’d have to test it myself

> **[Extensions Reference](https://dev.twitch.tv/docs/extensions/reference/#send-extension-pubsub-message)**
>
> Extensions Reference

That using the JWT from onAuthorised inside a config panel might work.

---

<div class="post-metadata">

**Author:** ![labureta](https://avatars.discourse-cdn.com/v4/letter/l/9fc29f/32.png) [@labureta](https://staging-discuss.dev.twitch.com/u/labureta)\
**Post date:** [February 6, 2019, 12:47am UTC](https://staging-discuss.dev.twitch.com/t/architecture-between-broadcaster-and-viewers/19889/3 "2019-02-06T00:47:11Z")

</div>

Here’s the confusion I got, i read the pubsub, but it says for the EBS to communicate with both the broadcaster and viewers, by what i understand the ebs MUST be in a dedicated server, could I put an “ebs” with the broadcaster?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [February 6, 2019, 10:59am UTC](https://staging-discuss.dev.twitch.com/t/architecture-between-broadcaster-and-viewers/19889/4 "2019-02-06T10:59:38Z")

</div>

```auto
### Authentication

Signed JWT (Twitch or EBS JWTs are allowed)

```

You can use the the Twitch JWT from onAuthorised

You are right than an EBS is a web accessible “dedicated server”, and it has to remain under your control, you cannot give it to the broadcaster to keep on their side, as in order to generate an “EBS JWT” you need the Extension Secret.

And as per the Developer Agreement/TOS you need to keep your secrets, secret. And they are not secret if they live in an application on someone elses computer as apposed to an EBS you control.

Additionally instead of going straight to the “Send Extensions Pubsub Message” you can use the Javascript Helper send function

### send

`twitch.ext.send: function(target: String, contentType: String, message: Object)twitch.ext.send: function(target: String, contentType: String, message: String)`

This function can be called by the front end to send directly to PubSub. It uses the Twitch-provided JWT for broadcasters, to allow broadcasters to send a broadcast (channel) or whisper message. Broadcasters cannot send to global.

> **[Helper: Extensions - Extensions Reference](https://dev.twitch.tv/docs/extensions/reference/#helper-extensions)**
>
> Reviews for chatbot verification continue to be temporarily paused while we revise our processes. Reviews for Extensions, developer organizations, and game ownership have resumed. Thank you for your patience and understanding. | Extensions Reference

Scroll to `send`

---

<div class="post-metadata">

**Author:** ![labureta](https://avatars.discourse-cdn.com/v4/letter/l/9fc29f/32.png) [@labureta](https://staging-discuss.dev.twitch.com/u/labureta)\
**Post date:** [February 6, 2019, 9:43pm UTC](https://staging-discuss.dev.twitch.com/t/architecture-between-broadcaster-and-viewers/19889/5 "2019-02-06T21:43:21Z")

</div>

Very interesting, totally missed that, so to clear up i must host a ebs to keep the developer secret secret but i can make the broadcast application use the pubsub to broadcast the messages to his channel/viewers correct?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [February 6, 2019, 10:39pm UTC](https://staging-discuss.dev.twitch.com/t/architecture-between-broadcaster-and-viewers/19889/6 "2019-02-06T22:39:32Z")

</div>

> [@labureta](#):
>
> i can make the broadcast application use the pubsub to broadcast the messages to his channel/viewers correct?

Correct. The broadcaster JWT from the config panel should suffice

> [@labureta](#):
>
> i must host a ebs to keep the developer secret secret

For Pubsub broadcasting pretty much. if needing to ding from the broadcasters actual computer not the Twitch dashboard/other extension panel

---

<div class="post-metadata">

**Author:** ![labureta](https://avatars.discourse-cdn.com/v4/letter/l/9fc29f/32.png) [@labureta](https://staging-discuss.dev.twitch.com/u/labureta)\
**Post date:** [February 6, 2019, 11:30pm UTC](https://staging-discuss.dev.twitch.com/t/architecture-between-broadcaster-and-viewers/19889/7 "2019-02-06T23:30:34Z")

</div>

Alright, thanks a lot for sharing your knowledge, i will give it a whirl!

---

<div class="post-metadata">

**Author:** ![system](https://d2spem0quai2ol.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://staging-discuss.dev.twitch.com/u/system)\
**Post date:** [March 8, 2019, 11:30pm UTC](https://staging-discuss.dev.twitch.com/t/architecture-between-broadcaster-and-viewers/19889/8 "2019-03-08T23:30:38Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
