Hi all,
I’ve been working on a custom layout for twitch, and wanted to use PubSub for getting bits and subscriber notifications. I was using socket.io for the connection but didn’t seem to connect at all, so I switched to the native WebSocket library. I was able to connect with that, but am getting a ‘ERR_BADAUTH’ when trying to subscribe to the subscriber topic. I know the token I’m passing is good since I’m using the same for my website, and I am omitting the ‘oauth:’ portion too.
twitchSocket.onopen = (event) => {
console.info('socket connected!');
intervalId = setInterval(this.socketHeartbeat, 2 * 60 * 1000);
twitchSocket.send(JSON.stringify({
type: 'LISTEN',
data: {
topics: ['channel-subscribe-events-v1.MyUserID', 'channel-bits-events-v1.MyUserID'],
auth_token: 'abc123', // changed for security
},
}) );
};
That’s my connect code if it helps. I was able to connect fine without the subscriber event as well.