Open iGwkang opened 3 years ago
This is a bit tricky due to the different underlying types of websocketpp::config::asio_client and websocketpp::config::asio_tls_client which cannot simply be configured. On the website or somewhere in the github issues, there is an example of how to achieve this by inheritance.
I have modified the debug_client example to support both with a "simple" inheritance wrapper, but you will note that it's still a bit rocky. This should be what you're looking for: https://github.com/barsnick/websocketpp/commit/3375a500cdee13ea8af271dd099e069c3476e9e0
This could be expanded to the other examples, and should probably become a pull request.
The short answer here is that you will need two different endpoints (one that uses a TLS config and one that does not) and code to decide which endpoint to initiate the connection via.
The long answer, as @barsnick mentions, is that this is something that is clunky to do right now and the library probably should have a bundled wrapper that does so.