IRC Help - Issue Receiving PINGs

I’ll preface this by saying I had no IRC knowledge a few days ago and creating a chatbot is my way of getting into learning about IRC and Python.

For the most part everything’s been working fine and I can join a channel, send/receive chat messages etc. etc. but I only recently noticed that my bot was never sending a PONG back to the server. Since I generally tested in short sessions at this early stage in the bot it never had a chance to be disconnected.

But that’s when I tried to fix it and I realised it wasn’t the PONG which was the issue, but the bot never even receives a PING from the server, so of course it isn’t sending anything back. I don’t know if it’s something to do with how I set it up or if it’s my router blocking the PING requests they just don’t show up. Again, the login passes, the bot joins the channel and can both send/receive/read/respond/whatever to anything in chat but if I leave it there there will never be a PING to respond to.

Is there maybe something obvious I overlooked or any pointers in the right direction to what could cause this?

You should receive a PING occasionally like this: PING :tmi.twitch.tv. It’s difficult to help you any further without any code though.

I’ve seen it not send PINGs at all, therefore the best thing to do would be for you to PING the server every 5 minutes if you did not receive a PING from it, and it should reply back with PONG.

You can see more about this here: Bot Disconnecting

Hope this helps!

I guess it makes sense I could just keep the connection alive by initiating with my own PING if I didn’t receive any. Didn’t cross my mind.

Interestingly I received my only PINGs from Twitch so far only after I sent my own PING to begin with. I’ll have to run some timing on it but it seems like Twitch is waiting too long to send it’s first PING to me so the connection just gets terminated before I have a chance to respond. A little odd but everything seems fixable now.

Thanks!

1 Like

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