Connect to Twitch Chat

Idk how to say this, but I want to grab the twitch chat of my channel not from an IRC connection, but through the browser. Here is the url link I’m using: http://www.twitch.tv/lolyou/chat?opentga=1 to get lolyou’s chat. However, I want to make a connection to this url headlessly, and just receive changes in the DOM without the visual part. Is there anyway to do this? And again, I don’t want to make a connection through IRC. Thanks!

You can’t make your site interact with the embedded chat’s js, but you can use websockets to connect to chat. If you only need to read messages and not send them, you can use justinfan123 as the NICK so you don’t need to ask the user to authorize your site.

But isn’t NICK for IRC connection? How would you do this with websockets?

The protocol is same only it’s IRC over WebSockets and not raw TCP.

Oh ok. What’s the best possible approach for this in Java?

Java or Javascript?

Java. It’s not actually a web application, its just a fun project I was working on :smile:

If it’s not a web application then it would be easier to use IRC directly and ignore WebSockets since you aren’t forced to work around the security limitations of the browser environment.

The problem I’m running into is with PircBot, the IRC library I’m using in Java, it’s using up a lot of cpu because it keeps polling for new chat messages, and when I’m running multiple PircBot instances across multiple threads my cpu goes to poop. Is there a way I can have the threads sleep for like 10-15 seconds and then do one check for all of the messages? Btw, I’m trying to keep track of multiple chats at once, and I need the least cpu intensive way of doing this. That’s why I was trying to think of a way to do it with the website because my friend was able to be idle in 100 different chatrooms in his browser with little to no lag.

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