Connect to PubSub

When connecting to wss://pubsub-edge.twitch.tv, how do you pass in credentials?

wscat -c “wss://pubsub-edge.twitch.tv:443”
connected (press CTRL+C to quit)
PASS xxx
NICK xxx

The above works for wss://irc-ws.chat.twitch.tv, but not for pubsub-edge.twitch.tv. What’s the right way to establish this connection?

You pass in the required credentials when you listen to a topic. See the pubsub documentation for details https://dev.twitch.tv/docs/pubsub/

Is there a way to see this working with wscat on the commandline? I’ve tried various messages (including a basic PING) from the PubSub docs and don’t receive a response.

This is how it works for PING, for anyone else needing help. wscat could not deal with the multilines I was pasting in.

wscat -c “wss://pubsub-edge.twitch.tv”

{ “type”: “PING”}
< { “type”: “PONG” }

Or for LISTEN to channel-subscribe-events:

{ “type”: “LISTEN”, “nonce”:“23456dghj”, “data”: { “topics”: [“channel-subscribe-events-v1.XXX”], “auth_token”: “XXX” } }
< {“type”:“RESPONSE”,“error”:"",“nonce”:“23456dghj”}

^ Empty error means no error.

1 Like

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