[SOLVED] Twitch.listen is never triggered?


#1

Hi,

twitch.listen('broadcast', function (target, contentType, color){})

I tried to test the Hello World example but there is something i don’t get it. Why this line above is never triggered ? I don’t have any error in the terminal or in the browser console about this problem. Also it seems that twitch.send() works.

Thanks


Twitch.listen doesn't trigger
#2

I assume you’re referring to:

Are you certain that the client is receiving a pubsub broadcast message? You should be able to validate this by checking Chrome’s dev tools. The network tab, click on the websocket connection, and click on the frame tab. You should be able to see incoming pubsub messages and confirm whether you are receiving them or not. If you are receiving them, but the event doesn’t seem to be invoked, we can work from there.


#3

Yes i’m referring to this line but in the example when we click on the button to change the color of the circle, client send an ajax request to the EBS and the EBS send a message to the pubsub, so this is weird, the twitch.listen function should be triggered

I tried to send a broadcast message in the client using twitch.send, in the browser it seems that the message send well, but twitch.listen don’t triggered either


#4

Ok i did what you say and i have a badauth : {“type”:“RESPONSE”,“error”:“ERR_BADAUTH”,“nonce”:“XxpMrNQwc9OKIlO0PxdiKxxxxxxxx”}

i don’t get it, i already checked multiple times. I’m missing something but i don’t see it.

here my script for starting the extension

@ECHO OFF

echo e[96m cd developer-rig folder e[0m
cd developer-rig/

echo e[91m Starting Developer Rig service e[0m
SET EXT_CLIENT_ID=vl5y7ow6gh04t2o94z3kk4loexxxxx
SET EXT_SECRET=fhztOFj5vkKXCCbrtRbiKGZyPve7UeNiOWyuaIlxxxxx
SET EXT_VERSION=0.0.1
SET EXT_CHANNEL=rig-test
SET EXT_OWNER_NAME=sirtilkeii
start cmd /k yarn start

echo e[91m Starting front-end hosting servicee[0m
start cmd /k yarn host -l ../extensions-hello-world/public/ -p 8080

echo e[96m cd extensions-hello-world folder e[0m
cd ../extensions-hello-world

echo e[91m Starting extension backend service e[0m
::start cmd /k node services/backend -c vl5y7ow6gh04t2o94z3kk4loexxxxx -s fhztOFj5vkKXCCbrtRbiKGZyPve7UeNiOWyuaIlxxxxx -o 10196xxxx
SET EXT_CLIENT_ID=vl5y7ow6gh04t2o94z3kk4loexxxxx
SET EXT_SECRET=fhztOFj5vkKXCCbrtRbiKGZyPve7UeNiOWyuaIlxxxxx
SET EXT_OWNER_ID=10196xxxx
start cmd /k node services/backend

PAUSE

#5

One issue I can see is you have a hyphen in your channel name ‘rig-test’. I did the same thing initially (think I even used the exact same name), the channel name has to be alphanumeric.

Once you change that you will also need to delete your browser’s localstorage because stuff like the token and channel name for each panel is stored there so just changing the command line argument isn’t enough.

Also in mine I used my username for the OWNER_ID rather than the userid which it looks like you are doing. From briefly reading the code it looks as though you need to use the same in both the rig and backend so maybe try using your username for both?

Also you are probably aware and it probably isn’t a big deal for your test project but you shouldn’t post your extension’s secret


#6

Yes i know about the EXT_SECRET (already created a new one just in case) and thanks this is working.

The problem was the hyphen in “rig-test”

Thank you Boingy and swiftyspiffy for your help