I’m sending a message to wss://pubsub-edge.twitch.tv:443 over WebSocket to subscribe to the subscriber topic, here is the payload.
{
"type":"LISTEN",
"nonce":"44h1k13746815ab1r2",
"data":{
"topics":["whispers.125360799"],
"auth_token":"REMOVED"
}
In Java : String payload = “{"type": "LISTEN","nonce" "44h1k13746815ab1r2","data": {"topics": ["whispers.125360799"],"auth_token": "REMOVED" }”;
And I just don’t get any response, but if I send something like this:
{
"type":"LISTEN",
"nonce":"44h1k13746815ab1r2"
}
I actually receive an error message.
You are trying to subscribe to the whispers topic in your code, so of course you won’t get subscribers over the wire.
I have removed your oAuth tokens which you are NOT supposed to post publicly, as that is against the Dev TOS you already agreed to.
This tokens are no longer valid, I tried channel-subscribe-events-v1.channel ID too, oh sorry thats the wrong json, here is the current one:
{
"type":"LISTEN",
"nonce":"44h1k13746815ab1r2",
"data":{
"topics":["channel-subscribe-events-v1.125360799"],
"auth_token":"token"
}
It just that the docs say that i should get a response:
{
"type": "RESPONSE",
"nonce": "44h1k13746815ab1r2",
"error": ""
}
But I don’t get anything
Are you logging the RAW data being sent by server server?
If you are using a helper library it might not float back a listen non error response?
I’m using the Reactor’s Reactive WebSocket API, the thing is that it works perfectly fine for the irc server, and yes I’m logging the raw data
here is the error response when I send a bad request
The token you are using is authorised for the channel you are requesting to listen on?
Yes
Maybe I’m getting the wrong token, is there a method to get the token with some other method, so i can test it out? I’m currently receiving it via code.
ah
You didn’t finish the oAuth legs
You need to exchange the code for an access token
Step 2->Step 3
I’ve done the 3 step too, because i use the token to get the user info from twitch to authorize in my app. I actually tested it with simple http request and got this response
{
"access_token": "token",
"expires_in": 14979,
"refresh_token": "rToken",
"scope": [
"channel_subscriptions"
],
"token_type": "bearer"
}
and used the token, but the result is the same
Red_Gangplank:
{
"type":"LISTEN",
"nonce":"44h1k13746815ab1r2",
"data":{
"topics":["whispers.125360799"],
"auth_token":"REMOVED"
}
In Java : String payload = “{“type”: “LISTEN”,“nonce” “44h1k13746815ab1r2”,“data”: {“topics”: [“whispers.125360799”],“auth_token”: “REMOVED” }”;
If this is a direct copy paste from what you generated. The JSON is invalid.
You are missing a }
on the end
You closed “data” but you didn’t close the whole object.
OMG that’s it, thank you so much. Such a stupid mistake. Sorry for wasting your time.
1 Like
system
Closed
May 22, 2019, 12:40pm
13
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.