Twitch IRC connection troubleshooting

I tried Twitch to OSC from Pixel Party (https://gumroad.com/l/twitch_to_osc_pixel_party) and I can’t seem to connect to Twitch. I also tried to work through Elburz’s tutorial here: https://interactiveimmersive.io/blog/content-inputs/twitch-chat-in-touchdesigner/ and I’m just not seeming to be able to connect to Twitch. I’ve got all of the messages constructed in my websocket_callbacks DAT, and I get this block printed when I activate the websocket:
python >>>
/project1/websocket1 GET / HTTP/1.1
Origin: http://irc-ws.chat.twitch.tv
Host: irc-ws.chat.twitch.tv
Cache-Control: no-cache
Pragma: no-cache
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: PcF4PR4fpC4yblOJKbBUdA==
python >>>
/project1/websocket1 connected

I just don’t get any of the connection messages back from the server. I’ve double-checked my oauth and tried refreshing with new ones, checked and tried disabling firewall, tried on another machine, but I just don’t seem to get through. It seems like I’m missing something. Where do I go from here on troubleshooting? How can I figure out what exactly is failing?

Thanks!
Brandon

Can you remove your Twitch credentials and share a TOX?

Sure, didn’t bother before because even the “off the shelf” Twitch to OSC isn’t working for me. Can’t get into the network there though, so no way to know what’s going on.

twitchConnect.4.toe (4.0 KB)

Ok. It looks like you didn’t join the channel as shown on Elburz’ tutorial:

    channel_name = 'yourusername'
	join_message = 'JOIN #{}'.format(channel_name)
	dat.sendText(join_message)

Check out the Reference Script at the bottom.

Yeah, I’m aware of that section, but with what’s included, according to the tutorial, we should be able to connect and get “:tmi.twitch.tv 001 :Welcome, GLHF!” etc. But even ignoring the tutorial completely, I still can’t connect when I use the ready made Toe from Pixel Party that I linked above. It seems like it’s gotta be some networking thing. I’ve made sure that TD is allowed through the Windows firewall and I even tried disabling that completely but got no change. Is there anything else to check down that route? The other machine that I tried is on the same network, so maybe some router thing?

You’re initiating an outbound socket connection on that server, and the socket stays open for the duration so it’s not the first place I’d look (especially since the socket reports that it was open).

What versions of TD/OS? The next messages you’re missing in the Textport relate to upgrading to a secure socket, then the “:tmi.twitch.tv 001 :Welcome, GLHF!” message should come in.

Ok, so I was running build 2020.20625 because that’s what my commercial license is limited to on updates. I updated to 2020.22080 and the same code immediately gets me connected with fresh credentials. This has to be a bug in that build, right?

Not necessarily a bug, maybe just an older dependent library. Quite possible though.

Actually the release notes for 2020.22080 say:

WebSocket DAT - Added onConnect() and onDisconnect() callbacks

So it probably wasn’t getting called at all.

Oh wow, interesting. I could’ve sworn that onConnect() and onDisconnect() were in the callback DAT when I opened it to follow along. Either way, for now I’ll just work on the Twitch stuff in the current build. If those callbacks weren’t in the older version, do you have suggestions for how to tweak it to work? It does suck to already be coming up against reasons to have to buy the updates.

I suppose that explains why Markus’ implementation here is so complicated. You can try to pick this apart in the exec DATs: Twitch API and PubSub access

Yeah, you can see I was in that thread about a week ago. I just thought I’d try Elburz’s method first when it popped up since it seemed easier. Which, now that I know what’s up, it definitely is. Thanks for your help.

Just saw this thread now, but heard some similar issues with other folks in the HQ PRO that they had to upgrade to latest stable for the twitch connections to work unfortunately. Glad you got it up and running!

1 Like

Did anyone ever figure out why the websocket connection seems to quietly time out or whatever every so often? I saw it happening in Elburz’s tutorials and he mentioned trying to get to the bottom of it if it persisted…