chronoxor / CppServer

Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
MIT License
1.43k stars 284 forks source link

How to connect to a wss:// URL ? #55

Closed whyCPPgofast closed 3 years ago

whyCPPgofast commented 3 years ago

Hi, Your library looks very clean. How do I connect a ws client to a wss:// url? In examples I only see IP address. Do I have to create my own DNS resolver?

chronoxor commented 3 years ago

If you need to connect over DNS please create an instance of TCPResolver and call ConnectAsync(resolver) method and pass it as a parameter:

auto resolver = std::make_shared<Asio::TCPResolver>(service());
client.ConnectAsync(resolver);

In this case DNS resolver will be used to resolve address into server IP.

whyCPPgofast commented 3 years ago

Amazing, thank you