IXWebSocket icon indicating copy to clipboard operation
IXWebSocket copied to clipboard

SSL - Internal error trying to connect to a secure websocket

Open Flix3r opened this issue 7 months ago • 0 comments

When trying to connect to a secure websocket I get the following output:

Connection error: Unable to connect to server.dev on port 443, error: error in handshake : SSL - Internal error (eg, unexpected failure in lower-level module)

Here is my code:

    ix::initNetSystem();
    webSocket.setUrl("wss://server.dev/ws");
    
    ix::SocketTLSOptions tlsOptions;
    tlsOptions.caFile = "C:/path/to/cacert.pem";
    webSocket.setTLSOptions(tlsOptions);
    std::cout << "Connecting websocket..." << std::endl;


    webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg)
        {
            if (msg->type == ix::WebSocketMessageType::Message)
            {
                std::cout << "Received message: " << msg->str << std::endl;
            }
            else if (msg->type == ix::WebSocketMessageType::Open)
            {
                std::cout << "Connected successfully" << std::endl;
            }
            else if (msg->type == ix::WebSocketMessageType::Error)
            {
                std::cout << "Connection error: " << msg->errorInfo.reason << std::endl;
            }
        }
    );

    webSocket.start();

Flix3r avatar Jun 11 '25 11:06 Flix3r