add notes about ssl configuration in demo program
This commit is contained in:
parent
0e0a748037
commit
54db6ec8bb
@ -24,6 +24,7 @@ A bad security bug affecting users compiling with SSL enabled and OpenSSL as the
|
|||||||
|
|
||||||
#include <ixwebsocket/IXNetSystem.h>
|
#include <ixwebsocket/IXNetSystem.h>
|
||||||
#include <ixwebsocket/IXWebSocket.h>
|
#include <ixwebsocket/IXWebSocket.h>
|
||||||
|
#include <ixwebsocket/IXUserAgent.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
@ -34,6 +35,8 @@ int main()
|
|||||||
// Our websocket object
|
// Our websocket object
|
||||||
ix::WebSocket webSocket;
|
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");
|
std::string url("wss://echo.websocket.org");
|
||||||
webSocket.setUrl(url);
|
webSocket.setUrl(url);
|
||||||
|
|
||||||
@ -53,6 +56,12 @@ int main()
|
|||||||
std::cout << "Connection established" << std::endl;
|
std::cout << "Connection established" << std::endl;
|
||||||
std::cout << "> " << std::flush;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
10
main.cpp
10
main.cpp
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <ixwebsocket/IXNetSystem.h>
|
#include <ixwebsocket/IXNetSystem.h>
|
||||||
#include <ixwebsocket/IXWebSocket.h>
|
#include <ixwebsocket/IXWebSocket.h>
|
||||||
|
#include <ixwebsocket/IXUserAgent.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
@ -25,9 +26,12 @@ int main()
|
|||||||
// Our websocket object
|
// Our websocket object
|
||||||
ix::WebSocket webSocket;
|
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");
|
std::string url("wss://echo.websocket.org");
|
||||||
webSocket.setUrl(url);
|
webSocket.setUrl(url);
|
||||||
|
|
||||||
|
std::cout << ix::userAgent() << std::endl;
|
||||||
std::cout << "Connecting to " << url << "..." << std::endl;
|
std::cout << "Connecting to " << url << "..." << std::endl;
|
||||||
|
|
||||||
// Setup a callback to be fired (in a background thread, watch out for race conditions !)
|
// 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 << "Connection established" << std::endl;
|
||||||
std::cout << "> " << std::flush;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user