I see that I have to define an on_tls_init and have the set_tls_init_handler to point to this on_tls_init for secure connections. What happens when set_tls_init_handler is not set? Does webscoketpp go head with the connection over ws:// instead of wss:// or is the connection dropped?
how does websocketpp handle connections when set_tls_init_handler is not set?
562 views Asked by ssn At
1
WebSocket++'s transport security behavior is based on which config your endpoint uses. If your endpoint is configured to be secure, i.e. using a config, like
websocketpp::config::asiowhose transport socket type performs TLS encryption then not defining a tls init handler (or not returning a valid TLS context from it) will result in connections failing with aninvalid_tls_contexterror.If you want plain/unencrypted/"ws://" connections you should use an endpoing config that does not perform TLS encryption (for example
websocketpp::config::asio_no_tls). An endpoint compiled with that config will ignore the tls handler.