diff --git a/README.md b/README.md index a06e8359..c821f8f1 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ A bad security bug affecting users compiling with SSL enabled and OpenSSL as the #include #include +#include #include int main() @@ -34,6 +35,8 @@ int main() // Our websocket object ix::WebSocket webSocket; + // Connect to a server with encryption + // See https://machinezone.github.io/IXWebSocket/usage/#tls-support-and-configuration std::string url("wss://echo.websocket.org"); webSocket.setUrl(url); @@ -53,6 +56,12 @@ int main() std::cout << "Connection established" << std::endl; std::cout << "> " << std::flush; } + else if (msg->type == ix::WebSocketMessageType::Error) + { + // Maybe SSL is not configured properly + std::cout << "Connection error: " << msg->errorInfo.reason << std::endl; + std::cout << "> " << std::flush; + } } ); diff --git a/main.cpp b/main.cpp index 31785992..8512537f 100644 --- a/main.cpp +++ b/main.cpp @@ -15,6 +15,7 @@ #include #include +#include #include int main() @@ -25,9 +26,12 @@ int main() // Our websocket object ix::WebSocket webSocket; + // Connect to a server with encryption + // See https://machinezone.github.io/IXWebSocket/usage/#tls-support-and-configuration std::string url("wss://echo.websocket.org"); webSocket.setUrl(url); + std::cout << ix::userAgent() << std::endl; std::cout << "Connecting to " << url << "..." << std::endl; // Setup a callback to be fired (in a background thread, watch out for race conditions !) @@ -44,6 +48,12 @@ int main() std::cout << "Connection established" << std::endl; std::cout << "> " << std::flush; } + else if (msg->type == ix::WebSocketMessageType::Error) + { + // Maybe SSL is not configured properly + std::cout << "Connection error: " << msg->errorInfo.reason << std::endl; + std::cout << "> " << std::flush; + } } );