IRC client can send but not receive

I am trying integrate Twitch chat into a Unity app, and I have been able to connect via IRC using a TcpClient.

I successfully logged in, I can join channels and send chat messages, but no messages show up from any other users, and the user list is empty. I also receive pings from Twitch. Here is the connection log:

:tmi.twitch.tv 001 [user] :Welcome, GLHF!
:tmi.twitch.tv 002 [user] :Your host is tmi.twitch.tv
:tmi.twitch.tv 003 [user] :This server is rather new
:tmi.twitch.tv 004 [user] :-
:tmi.twitch.tv 375 [user] :-
:tmi.twitch.tv 372 [user] :You are in a maze of twisty passages, all alike.
:tmi.twitch.tv 376 [user] :>
:[user]![user]@[user].tmi.twitch.tv JOIN [channel]
:[user].tmi.twitch.tv 353 [user] = [channel] :[user]

Like I said, I can send messages, and have confirmed this through twitch channel chats, so the connection is clearly working, and it stays open. But I’m not getting any messages - seemingly other than pings.

Also, I have been able to connect to a non-Twitch IRC channel, and could receive messages there. Is there a different way that Twitch IRC works that could be the problem?

Thanks.

Nope, should work out of the box. What channel and server are you connecting to? Take note that some channels (big ones) are hosted on event servers and connecting to normal irc servers won’t give you the messages for that channel.

You can check what servers are there, an which of them are “alive” at http://twitchstatus.com/

Thanks for the response! I’ve just tried connecting to irc.twitch.tv - does that just pick an arbitrary server? I just tried connecting to specific servers with the same results.

I’m testing on my development channel (PsydraGames), which is definitely not big enough to be on the event server. Does the channel have to be live for some reason? Other IRC clients don’t seem to care.

That’s odd, it dosen’t seam to work. In addition, the mod list returned by the server is empty. I’d say that this must be some sort of internal Twitch problem speciffic to your channel :frowning:

Might want to try testing on some other channel and wait for twitch support to look into it?

Well, turns out you need to use lowercase names when joining a channel, otherwise it wont work …

Try doing

JOIN #psydragames

Thanks for looking into it! I have been using all lowercase - I don’t think the send messages would work either had I not been able to join the channel at all. I’ve also tried it on another channel with the same results.

mIRC works fine with both sending and receiving messages, but my Unity client can only send. And my Unity client user doesn’t show up in the user list in mIRC when I’m running both (connected to different accounts). The reverse is also true; my Unity client will only display its own user in the user list.

Well, that’s odd, as I can connect and see messages just fine when using lowercase channel name:

bash-4.3# telnet irc.twitch.tv 6667
Trying 199.9.249.253...
Connected to irc.twitch.tv.
Escape character is '^]'.
PASS oauth:**REMOVED**
NICK itbot
:tmi.twitch.tv 001 itbot :Welcome, GLHF!
:tmi.twitch.tv 002 itbot :Your host is tmi.twitch.tv
:tmi.twitch.tv 003 itbot :This server is rather new
:tmi.twitch.tv 004 itbot :-
:tmi.twitch.tv 375 itbot :-
:tmi.twitch.tv 372 itbot :You are in a maze of twisty passages, all alike.
:tmi.twitch.tv 376 itbot :>
JOIN #psydragames
:itbot!itbot@itbot.tmi.twitch.tv JOIN #psydragames
:itbot.tmi.twitch.tv 353 itbot = #psydragames :itbot
:itbot.tmi.twitch.tv 366 itbot #psydragames :End of /NAMES list
:btm_pl!btm_pl@btm_pl.tmi.twitch.tv PRIVMSG #psydragames :test1

The last line:

:btm_pl!btm_pl@btm_pl.tmi.twitch.tv PRIVMSG #psydragames :test1

is a message sent by the webchat. Also, I see that someone (you?) just joined the channel:

:trent_sterling!trent_sterling@trent_sterling.tmi.twitch.tv JOIN #psydragames

Can you post the raw input/output to the IRC connection from your unity client? (Filter your password though)

I just checked #beyondthesummit to confirm. 48k viewers, 18k chatters and the IRC-channel is silent. How would one connect to these big events with mIRC? Are the servers available through public API?

Edit: Some messages trickle through, every now and then… would suggest it’s hosted on tmi.twitch.tv, but it struggles to send out IRC-messages? (using TWITCHCLIENT 3)

Go to http://twitchstatus.com/ and check the IP of “Event chat” servers - those are the servers used for big channels (tournaments, TPP). If you get “some” messages you’re probably getting messages from people also using tmi.

1 Like

I’m honestly not exactly sure how “raw” you’re looking for it to be - the stream reader is reading with default encoding (I’m new to networking code, so I could easily be missing something), but here is the output I get, with “->” being sends and “<” being receives.

<- Connecting
-> PASS [oauth]
-> NICK ifdogthen
-> USER ifdogthen
-> JOIN psydragames
<- :tmi.twitch.tv 001 ifdogthen :Welcome, GLHF!
<- :tmi.twitch.tv 002 ifdogthen :Your host is tmi.twitch.tv
<- :tmi.twitch.tv 003 ifdogthen :This server is rather new
<- :tmi.twitch.tv 004 ifdogthen :-
<- :tmi.twitch.tv 375 ifdogthen :-
<- :tmi.twitch.tv 372 ifdogthen :You are in a maze of twisty passages, all alike.
<- :tmi.twitch.tv 376 ifdogthen :>
<- :ifdogthen!ifdogthen@ifdogthen.tmi.twitch.tv JOIN psydragames
<- :ifdogthen.tmi.twitch.tv 353 ifdogthen = psydragames :ifdogthen
<- :ifdogthen.tmi.twitch.tv 366 ifdogthen psydragames :End of /NAMES list
-> PRIVMSG #psydragames :Delay start
<- ifdogthen: Delay start

The StreamReader is using ReadLine(), which I’m guess relies on a carriage return sign, so maybe that’s not being met, so I’m not receiving anything?

IRC channel names need to start with a #. Have you tried JOIN #psydragames?

Ha! Thank you, george; that worked!

I swear I tried that before, but my “PRIVMSG” was adding the #, where my “JOIN” wasn’t. So when I tried using #psydragames, I got errors sending messages because I guess it added a second #.

I’m a little confused as to why you can still send messages to Twitch chat without the #, but I’m too relieved that this finally works. Can’t believe I missed this. Thanks again!

The messages will be silently dropped if the channel is not valid.

But they weren’t dropped. I was able to see everything I was posting in both the Twitch web chat and on IRC using mIRC. It was also confirmed by another user that the messages I sent from the app (without the #) were being received. Somehow, it still allows messages to be sent without the proper IRC channel name, but not received.

Can confirm that you’re able to PRIVMSG channels you’re not on right now:

bash-4.3# telnet irc.twitch.tv 6667
Trying 199.9.249.252...
Connected to irc.twitch.tv.
Escape character is '^]'.
PASS {{nope}}
NICK btm_pl
:tmi.twitch.tv 001 btm_pl :Welcome, GLHF!
:tmi.twitch.tv 002 btm_pl :Your host is tmi.twitch.tv
:tmi.twitch.tv 003 btm_pl :This server is rather new
:tmi.twitch.tv 004 btm_pl :-
:tmi.twitch.tv 375 btm_pl :-
:tmi.twitch.tv 372 btm_pl :You are in a maze of twisty passages, all alike.
:tmi.twitch.tv 376 btm_pl :>
JOIN cereth
:btm_pl!btm_pl@btm_pl.tmi.twitch.tv JOIN cereth
:btm_pl.tmi.twitch.tv 353 btm_pl = cereth :btm_pl
:btm_pl.tmi.twitch.tv 366 btm_pl cereth :End of /NAMES list
PRIVMSG #cereth :cerHype
PRiVMSG #vortale :cerHype
PRIVMSG #elmagus :cerHype
PRIVMSG #night :cerHype

I’ve been present on #cereth with an IRC client and saw the message. Then I’ve opened a incognito Chrome and navigated to the 3 other channels - on none of which I’ve been via IRC, and saw the message on every oen of them.

TMI has always operated this way and it’s actually really convenient for a lot of bot operators so you can use separate connections for receiving and sending messages.

Thanks for following up on this, guys, definitely good to know!

Seems exploitable that you can send messages to several different channels that you’re not even connected to, but I guess mods and Twitch devs would crack down on it if it get spammed.

Posting a message to the channel still shows your name and mods can ban you, preventing future messages :wink:

The IRC spec actually says nothing about needing to JOIN a channel before being able to PRIVMSG at it. JOINs are meant only to “start listening to a specific channel”: http://tools.ietf.org/html/rfc1459#section-4.2.1

If you think of IRC not as a set of individual chat rooms but as a generic publish-subscribe system, with PRIVMSGs being publishes and JOINs subscribes, this idea may not seem so reeling.

3 Likes