PubSub Multiple Users

I am looking to read multiple twitch channels, channel point redemptions simultaneously. I currently know how to read a single channel’s redemptions, but am not sure how to syntactically do multiple twitch channels.

I use the PubSub to read a single channel and noticed it allows multiple topics, unsure if I need to get all users with a single auth token or create a list of both user topics and user auth tokens individually

When using pubsub, you sub with a topic and a token for that topic.

So you’ll send, for exmaple,

listen liriktopics liriktoken

then as a second listen request

listen ninjatopics ninjatoken

ws.onopen = function (event) {

    var messageListen = {
        type: 'LISTEN',
        data: {
            topics: ['channel-points-channel-v1.<userID>'],
            auth_token: '<token>',
        }
    };

    ws.send(JSON.stringify(messageListen));

    ws.onerror = function (error) {
        console.log('ERR:  ' + JSON.stringify(error) + '\n')
    };
};

Above is my code for example, would I have to do multiple ws.send for multiple users? Or is there a way to combine all the users into a single ws.send ?

You would need one ws.send per user.

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