Javascript custom webSocket chatbot fails only when streaming (can send messages but can't read)

Hello.

I’m developing a small html javascript script to read messages from twitch chat and print stuff in screen. I’m using the websocket example from https://github.com/twitchdev/chat-samples/blob/master/javascript/chatbot.js and creating the oauth token with https://twitchapps.com/tmi/.

Test1
-I open the html page in my preferred browser.
-I access my twitch channel (https://www.twitch.tv/xxxx) and send messages in the chat.
-The script correctly sends messages to chat and reads the messages from chat.

Test2
-I add the html page in OBS (as browser type) and start streaming.
-I access my twitch channel (https://www.twitch.tv/xxxx) and send messages in the chat.
-The script correctly sends messages to chat and reads the messages from chat.

Then I send the html script to a friend (he used his twitch username and generated his own oauth token). He reproduced Test1 and worked fine in his computer. Then he reproduced Test2 and it fails, the script can send messages to chat but can’t read them from chat. The difference between me and him is that my OBS is a regular “OBS studio” and I don’t have any other apps/plugins connected while streaming. On the other hand, my friend uses “OBS.live” and has streamlabs and some bots/stuff running while streaming.

Does that make sense? Can streamlabs be “stealing” the chat messages? Do I need to create the auth token in a different way, like, somehow registering my script in https://dev.twitch.tv?

Sorry if my explanation and/or questions don’t make too much sense, I’m kinda noob in all twitch stuff. Any help or suggestion will be appreciated. Thanks in advance!

This is bizarre,

sounds like your friend might have too many things going on, but you’d have to use OBS debug to go in and look for errors.

Last I checked ObsLive was just a plugin for OBS, so it shouldn’t be doing anything bizarre, but if they have OBSLive, streamlabs, bots and other stuff, could be an issue of too many cooks.

But again, you’d need to debug inspect the browser source to look for JS errors etc

Thanks for the quick response. I didn’t know OBS had a debug mode, so I’ll investigate that way. Best scenario my script is receiving the messages from server but, when parsing them, something explodes. I do hope that’s the reason crosses fingers

Change your shortcut to start obs to:

“C:\Program Files (x86)\obs-studio\bin\64bit\obs64.exe” --remote-debugging-port=9222

(Change path accordingly)

Open OBS

Then open

http://127.0.0.1:9222/ in a browser

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