I’m trying to make a custom chat application. However, trying to connect to irc.twitch.tv on port 6667 has proven to be quite a hassle - it tries to connect for a while but just fails saying that the host failed to respond. I can connect on 443 and 80, however - but those seem to be spotty at best. Yesterday it was working fine on port 443, today it gave me 400 Bad Request (maybe it connected me to a server which wanted to use websockets?)
Any help on this?
With all due respect, I don’t believe this is a duplicate. My problem is that port 6667 isn’t responding at all, which as far as I can tell is mentioned nowhere in that thread.
Curiously, the Chatty application on my computer has the exact same issue - it is never able to connect on port 6667, and instead falls back to 80 every single time.
Sigh, maybe time to switch to web sockets?
Are able to connect to any IRC server/network on port 6667? Some ISP to apparently block it.
That might be the case actually, so since 80 and 443 bark at me for trying to use regular old TCP sockets I’m now trying to use web sockets. Although they are mysteriously failing to connect… no helpful error messages or reason codes, just “failed to connect”. Which might be the fault of the library I’m using.
Is it valid to try and connect to ws://irc.twitch.tv:80 with a websocket?
EDIT: So far as I can tell Chatty just connects with regular sockets… and also my custom chat client started suddenly working again on port 80. Gah!
Currently “irc.twitch.tv” is resolving to 4 servers:
One of those servers, 188.8.131.52, is running WebSockets on ports 80 and 443. If you connect to another one of them you will be fine (for now).
If you reference the linked thread above you can use the “chat_properties” API to get the current list of servers.
OK, so presumably my app could query /api/channels/[channel-name-here], check the list of IPs under the “chat_servers” property and grab one with the port I want, then connect to that with regular old TCP sockets.
Seems easy enough, I think I’ve got a JSON library laying around here somewhere…
You don’t need to grab an IP list for every channel you want to join, just one for regular chat and one for event chat. If you grab the IP list for a channel in event chat, the server list it responds with will work for every channel that’s on event chat; and same for regular channels.
The best suggestion I’ve seen on these boards is to just use 1 channel to look up each, which never changes it’s type:
https://api.twitch.tv/api/channels/riotgames/chat_properties (event chat cluster)
https://api.twitch.tv/api/channels/night/chat_properties (main chat cluster)
Though the last time they changed the server IPs, I saw an announcement on this bobard before hand; so if you decided to just hardcode the list it wouldn’t hurt you, you’d just need to be aware of it.
And of course if your app will be connecting to channels on an individual basis, querying their “chat_servers” is certainly a robust way to do it, all depends on how you want it to work.
Yep, the client currently works by making the user specify which channel to join. Querying a random channel’s chat properties bugs my programmer OCD, and hardcoding it bugs my programmer OCD even harder XD
I’ve got it working just fine. This is in Unity, so I just construct a new WWW object to query the chat properties of the channel the user wants to join and deserialize it via JSON.NET, uses LINQ to get three servers (one on 6667, one on 443, and one on 80) and attempts to connect to each one, until one connection succeeds. This seems to be working perfectly.
My next task is to get chat badges and emoticons working. This may pose a challenge, as I have absolutely no idea how these are supposed to work. Maybe I should post another question on this? Unless there’s been one already asked.
EDIT: nvm, now using the IRC v3 API which provides handy emoticon info.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.