I have a small web applications where I use Twitch API to check if someone is online and then automatically my application receives and sends messages using PircBot’s onMessage(…) method and sendMessage(…) method.
I have been noticing this weird thing. After some hours (say like 15 or 20 or 24 hours), both those methods don’t work. When I start my application, messages are received and sent fine for the first few hours no problem. Then I would go to sleep or do something else. When I comeback after a half day or full day, I don’t see those methods sending and receiving messages.
So the question is, why PircBot’s onMessage(…) and sendMessage(…) methods don’t work after some hour? I have not tried/used other methods so I don’t know if they work or not. Is there a timeout thing that you have to reconnect to twitch chat after a few hours? I hope I described my problem well. Thanks
I am going to override onDisconnect() method meanwhile.
Well… I think overriding onDisconnect() method is the way to go. I just have to reconnect inside that method. Connection to twitch IRC can disconnect at any time.
Maybe you are sending to many messages, could be a Shadowban / Global.
-> Read: Command, JOIN & Message Limit
No osrs that’s not the reason. I have figured out what was the reason. Every few hours twitch IRC drops you. It is its job to do that. You just have to reconnect. That’s all. When server drops you or when your connection to server is disconnected, onDisconnect() method is automatically called. I just had to override it and reconnect inside that method. That’s it. Easy. I am back to receiving and sending messages within few milliseconds. And now my application is running for the past 1 and a half day and no issues. I check the logs and it shows that I was dropped by the server automatically at what time.
TL;DR, Server automatically drops you after every few hours. You just need to reconnect.
As far as I can understand you’re probably missing the Ping and Pong events could easily be the reason
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.