Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnect issue #184

Open
zdebel opened this issue Apr 23, 2021 · 1 comment
Open

Disconnect issue #184

zdebel opened this issue Apr 23, 2021 · 1 comment

Comments

@zdebel
Copy link

zdebel commented Apr 23, 2021

I can't seem to figure out how should I handle a disconnect case, my bot keeps disconnecting from time to time (either the irc network issue, or something on my end), the on_disconnect event doesn't get fired. Much obliged for a snippet.

@jaraco
Copy link
Owner

jaraco commented May 25, 2021

There are lots of conditions that can lead to disconnects (other than explicit client disconnect):

  • Server disconnects the client.
  • Client disconnects from the server (at OS level).
  • Intermediate network connectivity drops (temporarily, such as in outage).
  • Some intermediate network node drops the connection (blocked traffic, explicit disconnect).

The causes for these are varied, and it can be difficult to ascertain what conditions led to a disconnect or what node initiated the disconnect.

At a basic level, it's important to (a) send periodic keep-alive messages (pings), as servers may disconnect a client they believe to be idle, and (b) respond to keep-alive messages from the server.

If you're doing both of these, the best advice I can give is to inspect the client and attempt to elicit more detail about when the disconnects happen and why. Start with: how do you know your client is disconnected? Can you tell when the disconnection happened?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants