Pubsub subscriber / resubscriber example

Does anyone have an example of how to use the Twitch PubSub to track information like subscribers and resubs? I already looked at the Twitch Github ([] example code but am still pretty lost on how to properly use this.

Pubsub requires you to setup a listener.

That listener connects to Twitch Pubsub server.
It then requests topics
Then Twitch will send you events for those topics when they occur.

So when you say

What do you mean? What do you want to do?

I want to be able to grab new or re-subscriber events to push notifications.

Pubsub is documented here:

Pay attention to the connection management about ping/pong.

  1. Connect to pubsub using language of choice that supports websockets
  2. On connect send the listen command using the topic channel-subscribe-events-v1.<channel ID>
  3. Wait for messages and parse them

kind of a dumb question, but I dont have a partner/affiliate account, how can I test bits and subs? or am i not able to?

Find someone who is a partner/affiliate and willing to work with you. They’d need to go through your authentication process so you get a token, and you’ll use that with their pubsub topic.

damn, thats what i figured was going to have to happen. Thank you.

Stream yourself developing the application. You might get enough viewers to earn affiliate. :grinning:

oh, haha, i appreciate that, i actually qualified for affiliate a long time ago, I just never accepted bc of the exclusivity clause (2.2 or 2.4) I like multi-streaming, But i do appreciate the suggestion, thank you.

is there a way to spoof an Event? I am still new to the whole pubsub thing, so forgive me if thats a dumb question.

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