I can’t clearly find what this does in this library.
If you refer to https://swiftyspiffy.com/TwitchLib/PubSub/class_twitch_lib_1_1_pub_sub_1_1_twitch_pub_sub.html#a591a97841b79eeb6b4f145d3b0fca3e0
That is not directly supported by Twitch and can break/change at any time and it’s not advised to be used. It is not a “supported topic” - https://dev.twitch.tv/docs/pubsub#topics I also don’t think it works given the authentication requirements for that undocument/unsupported (for third parties) topic.
Twitch provides “extension pubsub”
Send from EBS: https://dev.twitch.tv/docs/extensions/reference#send-extension-pubsub-message
Send from Extension HTML/JS: https://dev.twitch.tv/docs/extensions/reference#send
Recieve in Extension HTML/JS: https://dev.twitch.tv/docs/extensions/reference#listen
Extension PubSub is “designed” as a “Fan Out” solution to Extension Clients not a “Fan In” solution to your EBS (or game as in this example). Additionally “Extension Viewers” generally won’t be able to broadcast a message via PubSub since viewers lack the authorisation to do so.
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.
So likely can’t be used for the game to recieve results of a vote. Since you can’t get the votes as they are cast, as the instance of the extension for a plain user doesn’t have the authority to broadcast.
Thats up to you to determine, design and create, Tiwtch doesn’t provide anything in this regard.
Which is used by your EBS (or other extension frontends) to send a messages to instance of the extension running on Twitch.
Game -> any medium -> EBS -> via Extension PubSub -> HTML
Game -> any medium -> EBS -> any medium -> HTML
HTML -> any medium -> EBS -> any medium -> Game
“Any Medium” is repaced with something you design and create
Generally for between Game <-> EBS and I’m rolling a Socket
And for HTML -> EBS I’m using plain JS Fetch making HTTP POST requests.
And Extension PubSub for EBS to HTML