beast: Getting `resolve: Host not found (authoritative)` from a valid address.

I’m trying to convert my discord library, Discord++, from Websocket++ to Beast, as Webscoket++ was (I think) causing random disconnects, and I’m getting a resolve: Host not found (authoritative) at the boost::asio::connect in

std::string const host = fetchGateway(token);
    boost::asio::ip::tcp::resolver r{asio_ios_};
    boost::asio::ip::tcp::socket sock{asio_ios_};
    boost::asio::connect(sock,
                         r.resolve(boost::asio::ip::tcp::resolver::query{host, "80"}));

as well as the SSL example. fetchGateway(token) is calling this Discord API endpoint to get the URL wss://gateway.discord.gg with CurlPP. It worked with Websocket++, I’m probably doing something very wrong here. Does anyone know what?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Ok

Edit: I have homework to do and I haven’t eaten today, but I’ll get back to it as soon as I can. Thank you so much everyone!

You have to remove the protocol in the gateway URL and use https instead of the port. You can take a look at how I did this here. I also get regular disconnects from the Discord gateway, and I suspect Discord being at fault here rather than the client library.