Hey,
I’m currently looking into creating a Twitch extension for our game and am searching for the best way to send user actions from viewer extensions to the streamer’s extension. Is there a way using the PubSub system other than generating extension JWTs with the scope to whisper messages to the streamer? Additionally, what are the rate limits on whispers? The same as channel-wide broadcast?
Thanks!
as a viewer inside an extension front end? No
Extension PubSub Whispers belong to a channel and share the channel pool of messaging.
So you send to broadcast
channel A and to a whisper-x
on channel A, they share the same pool of 100.
The Optimal Approach in my opinion:
- viewer makes an action
- the extension HTTP Posts that action to your server
Then
- your server then forwards that action/action result (after validation) using whatever method you want to the game
and/or
- your server forwards the action/action result using
broadcast
to all instances of the extension using pubsub (not on the whisper topic imo) so all viewers of the channel/the broadcaster are notified of an action/action result
Thanks for the quick reply!
Yes that definitely seems like the optimal approach and we might look into that. But we’re also trying to find out if our usecase can be solved without the need for an EBS.
Is it possible to post chat messages as the extension user from within the frontend extension? The helix token provided to the extension can neither be used to access the twitch chat irc endpoint nor has it the required scopes, correct? Is there a way to use the implicit code grant flow from within the extension or would this again only be possible using the authorization code grant flow using an EBS to receive the token?
No there isn’t a way for a viewer to broadcast a message to everyone/anyway else (ignoring bits purchases for simplicity of this dicussion)
Not really no.
Correct
The helix token has no scopes and doesn’t reperesent a user.
It only lets you read “public”/scopeless data from the API
Sure you can but then you are asking a user to authenticate Twice and it’s clunky, and having not tried myself it would be interestting to get the token back to the original window. Since you’ll have to open a new window to auth and then return the resultant token.
Which is even more complicated when we consider mobile.
Extensions are not suited to get additional permissions from the user/viewer.
And the whole point of an extension is to avoid the need for “chat spam” as the operational messaging is hidden by sending it to the server, instead of public in chat.
TLDR: Your use case requires an EBS.