C++ Asio connect to wss

  asio, c++, websocket

I am trying to connect to a secure websocket using asio.

This example will work for an ip address:

#include <iostream>
#include <asio.hpp>
int main() {
    asio::error_code ec;

    asio::io_context context;

    asio::io_context::work idleWork(context);

    asio::ip::tcp::endpoint endpoint(asio::ip::make_address("", ec), 80);

    asio::ip::tcp::socket socket(context);

    socket.connect(endpoint, ec);

    if (!ec) {
        std::cout << "Connected!" << std::endl;
    } else {
        std::cout << "Failed to connect to address: n" << ec.message() << std::endl;
return 0;

but how would I change it so I connect to "wss://api2.example.com"?

Source: Windows Questions C++