Coder Social home page Coder Social logo

Comments (9)

theIglooo avatar theIglooo commented on May 12, 2024

Isn't that expected? It can't resolve because there's no internet connection?

from discord4j.

iGoodie avatar iGoodie commented on May 12, 2024

@theIglooo shouldn't it keep trying to reconnect instead of throwing exception, just for such case? At least isn't that what withReconnects() method for, preventing any manual reconnecting situation such as losing connection for a sec?

from discord4j.

 avatar commented on May 12, 2024

There is no way the bot can even attempt to connect to discord if it can't lookup the IP address to connect to. Simple as that.

If it was going to keep on reconnecting (assuming the IP address is cached), you will eventually get a Connection refused or Connection timed out IOException.

from discord4j.

iGoodie avatar iGoodie commented on May 12, 2024

@LolDatSec at least it should run the same code chunk to prevent such case, instead of terminating the process.
EDIT: Also I can't handle that exception which gives me no other option than manually reconnecting. The reason I can't handle it because it is threw in the lib codes.

from discord4j.

theIglooo avatar theIglooo commented on May 12, 2024

@iGoodie That's not why you can't handle it, it's an unchecked exception. If that was case then you wouldn't be catching MissingPermissionsExceptions or any of those. I don't know what you want it to do, even if it hopelessly tries to reconnect it'll stop after the 3rd(?).

from discord4j.

austinv11 avatar austinv11 commented on May 12, 2024

When the lib encounters an error with the websocket, it is unrecoverable. You can try to login again later but a websocket error like this means that there is no use in trying to reconnect because the websocket wouldn't work correctly. And this is not something I can fix as all that code is internally Jetty Websocket's. And as previously mentioned, you have no internet connection so there's no use in reconnecting.

from discord4j.

austinv11 avatar austinv11 commented on May 12, 2024

Additionally, reconnects are mostly meant to reconnect to Discord after getting disconnected for some reason by Discord as Discord's cloudflare likes to randomly disconnect clients.

from discord4j.

iGoodie avatar iGoodie commented on May 12, 2024

Ummm but imagine that I lost my connection just for a second, then there is an use in trying to reconnect. Just like any application (like Discord) reconnects after you got your connection back.

from discord4j.

austinv11 avatar austinv11 commented on May 12, 2024

Yes, but it did try to reconnect. Additionally, you can still handle this yourself if the auto reconnect feature failed by listening for the DiscordDisconnectedEvent.

from discord4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.