PubSub Server Error Response

Hi guys,

I’m trying to listen to some topic using the Twitch API but when I send a web socket request to server(wss://pubsub-edge.twitch.tv) and using this (“topics”: [whispers.${id}]) a get a response like that {“type”:“RESPONSE”,“error”:“Server Error”,“nonce”:“WyrvWclEkWsUTk4”}

Does anybody knows what could be ?

The whisper topic requires an oAuth/token to be passed.

You did not send that token, not even a blank one.

Yes. I know it’s in the documentation, but I just tried everything and I’m still getting the same error. Could you help me If show you the code ? thanks

Is it possible listens to all events for given streamer ?

Yes, but only if you have a oAuth/token from that streamer with the relevant scopes. And kinda weird to be listening in on their whispers.

Not really

but heres my listen send, near enough:

ws.send(JSON.stringify({
    type: 'LISTEN',
    nonce: 'ARandomString',
    data: {
        topics: ['atopic','anothertopic'],
        auth_token: 'atoken'
    }
});

atoken is not preceeded by oauth:

Thank you. Let me reformulate my question. Is it possible to listen to all events from a given streamer ? For example, I have a input text where I put some name e.g (patty) and then I open a wss to listen to all events that occur in patty’s channel.

You would have to listen each topic you want to listen on in the topics there is not a “single” topic you can listen on, that delivers everything, additionally not “everything” is available on PubSub.

So yes, but you’d have to call more than one topic in the listen send. Or send multiple listen messages

A better question is what “events” are you after, as not all “events” (or what I would class as an event I need to consume for my streamers) is available via PubSub.

TLDR: Define “events”

Events means any changes in a given user profile.

A user profile consists of a username, profile image, description, and if authorized to view an email.

That information can be collected via webhooks, not pubsub

https://dev.twitch.tv/docs/api/webhooks-guide/

Great. Do you have any sample code/project (JS) as a reference ? Thanks Barry.

https://dev.twitch.tv/docs/api/webhooks-guide/
https://dev.twitch.tv/docs/api/webhooks-reference/

It’s “standard” webhooks. Just like PayPal IPN, you just need to use a HTTP POST to create and maintain a subscription.

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