Connect initialization error: endpoint not secure
I've used the library fine with my own ws: connections, but I'm trying to connect to a third-party wss: server. I've used this server for years when connecting from a web app (using javascript) but would now like to connect to it with c++ from a native app. Upon attempting to connect, I get this error:
Connect initialization error: endpoint not secure
Any advice is appreciated on how to make the connection. My understanding of networking is not robust enough for me to isolate where in the pipeline the issue might lie.
I'm getting a bit further, but when I changed my header from asio_no_tls_client.hpp to asio_client.hpp and also changed using client = websocketpp::client<websocketpp::config::asio_client>; to using client = websocketpp::client<websocketpp::config::asio_tls_client>; I then received this error in tls.hpp:
In file included from ../shared_headers/websocketpp/config/asio_client.hpp:33:
../shared_headers/websocketpp/transport/asio/security/tls.hpp:337:41: error: 'system' is not a class, namespace, or enumeration
lib::error_code translate_ec(boost::system::error_code ec) {
I am not using boost and the #define ASIO_STANDALONE has worked fine in the no_tls version. If I use a secure client config in websocketpp, is boost required?
I found an old issue on this where the error code was changed to be compatible with ASIO standalone, and upon downloading the updated library, that particular issue was resolved.
I will try to get my secure connection going now and report here any further challenges!
Thanks.
It appears I'm at a point where I don't know how to fill in the blanks and wishing that this utility_client tutorial at Step 7 had the level of details of the prior steps:
https://github.com/zaphoyd/websocketpp/blob/master/tutorials/utility_client/utility_client.md#step-7
I changed the header to asio_client.hpp and the config to websocketpp::client<websocketpp::config::asio_tls_client>; but this is clearly not enough to connect to a wss://... server. I have openssl built and linked as well and everything runs, but I get this: Connect initialization error: Connection creation attempt failed
it would be great to see a specific example of what to do next, similar to the excellent examples for the non-SSL connection.
i've pushed a first draft of some basic client examples, including one that demonstrates a TLS client that performs certificate chain and hostname validation. Check out print_client and print_client_tls on the develop branch.
Awesome, can't wait to look at this next week! thanks!
Would be great to have some more info to on how to use TLS on a client. According to the FAQ, the only thing needed is to switch out the config and the header with the respective TLS version.
Am I missing something? Because I end up with the same "> Connect initialization error: Connection creation attempt failed" and when trying to locate the error code I end up finding "Required tls_init handler not present." Being set by the ::init() function in "impl < endpoint_impl.hpp"
I've changed to the TLS files and included the OpenSSL library in my build configuration.
Any idea?
I found out that I needed to use set_tls_init_handler to get TLS to work, using you example.
Thank you!
https://github.com/zaphoyd/websocketpp/issues/706
refer this for tls (wss://)