Skip to content

SSL - Internal error trying to connect to a secure websocket #555

Description

@Flix3r

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();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions