Private topic for extension/events in pubsub

Our twitch extension needs a message forwarding system between streamers, viewers and our control server.
We looked at your pubsub-mechanism, it sounds very interesting.
But we have our own events/ messages which needs to be transported. Often they are NOT related to bits/ whisper events or other channel events mentioned in the documentation.

For example: some elements in our extension needs to get turned on/off due to events which our server sends.

I would like to connect to your pubsub-system, having my own extension topic where only my extension and my control server can send/recv messages.
Now I read something like broadcast topic (channel-ext-v1.<channel_id>-<extension_id>-broadcast, thanks ModestTim). Where can I find documentation about this? It sounds interesting.

We need to transfer messages “in realtime”. How reliable is PubSub? I read something about that I may get disconnected for up to 30s where I should keep trying to reconnect. How often did that happen? How long is PubSub live?

The method for sending pubsub messages from your control server to the extension users is documented here: https://dev.twitch.tv/docs/extensions/reference#send-extension-pubsub-message You can send whatever payload you want as long as it’s < 5KB, 1 message per second.

If you need to send messages from the broadcaster to the viewers using the live/config panels, you can use the send function in the frontend JS helper: https://dev.twitch.tv/docs/extensions/reference#send-functiontarget-contenttype-message

If you need to send messages from viewers to the backend, broadcaster, or other viewers, you cannot do this via pubsub. You will need to use ajax/sockets to send message to your control server, then have the control server broadcast the message via pubsub.

PubSub has been reliable for both the extensions I’ve used it in. I’m definitely not pushing any of the rate limits, but I haven’t recorded any outages or failed transmissions. It’s always live.

1 Like

You are mixing up the extension pubsub system with the “regular” Twitch Events pubsub.

An extension can listen on the extension pubsub for events sent by you from your EBS to you connected extension users.

Whispers/bits/commerce are on the “regular” pubsub and are seperate to the extension pubsub.

You shouldn’t be connecting to and listening on the channel-ext-v1 topic yourself. Hence there are not docs about connecting to Twitch PubSub to listen on this topic. As it’s not the correct route.

When you broadcast to the Extension pubsub it is private to the channel in question and only listened to by the users/viewers on that channel. (To do some any other way involves some jiggery pokery beyond ModestTim’s revealing of the Topic name)

Extension PubSub messages are delivered in real time, literally straight after you have emitted to the extensions PubSub transmit end point.

Sending Extension PubSub is documented:

And listening to those inside an Extension is documented:

This refers to “Regular” PubSub which you cannot transmit to, only listen on. And only for Topics such as Whispers and Bits that is documented:

Basically you have read a number of things on the forums and got yourself confused…

1 Like

xzion and BarryCarlyon, thank you very much for clarifying my communication problems.
I have message exchange working now.