-
Notifications
You must be signed in to change notification settings - Fork 725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating a socket.io CPP client no possible with SSL/TSL (SIO_TLS) enabled #349
Comments
Why did you switch to Also, can you verify the socket.io C++ version that you are using? There is no version 0.8.2 and the latest one is 3.1.0. Could you try with the latest master commit as well? |
If I need SSL support, the following instruction can be found: #if SIO_TLS This in turn results in a compile error that 'ASIO_STANDALONE' is not allowed. Therefore I tried out 'ASIO_SEPARATE_COMPILATION' because this is the only way to ensure that 'ASIO_STANDALONE' is not set 'behind the scenes'. As for the version 0.8.2 I was not precise: it indicates the WebSocket++ version. Sorry for that. In the meantime, I try using 'socket.io-client-cpp' with a different installation approach, i.e. via 'vcpkg' instead of the following the 'Without CMake' instructions. Thanks for your support. |
Ah I see. Which asio version are you using? I see from the project submodule that we are using chriskohlhoff/asio@230c0d2 as the commit fro asio. Check also all the submodules and make sure that you are using the same version as the submodule commit version. Those versions should be able to compile properly as the CMake can use them. |
I first started with the asio version that comes along if one Git clones recursively 'socket.io-client-cpp' and all its referenced submodules (see https://github.com/socketio/socket.io-client-cpp/blob/master/INSTALL.md#without-cmake). According to the 'readme' file it is V1.11.0. Later I tried to download all modules with there latest versions directly from Github. This results in v1.22.0 for asio. |
Hi, can you provide me with the file that you are using to compile? I cannot replicate your issue so maybe taking a look at what you exactly have will help me. |
Dear Joan Marcè Please find attached my sample. It builds fine if I follow the instructions you can find here: https://github.com/socketio/socket.io-client-cpp/blob/master/INSTALL.md#without-cmake Thanks for your support. |
Hi, find attached the fixed project. The difference is in the <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;SIO_TLS;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;ASIO_STANDALONE;_WEBSOCKETPP_CPP11_STL_;_WEBSOCKETPP_CPP11_FUNCTIONAL_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<!-- Here I've added the include directories of the OpenSSL library -->
<AdditionalIncludeDirectories>C:\Program Files %28x86%29\OpenSSL-Win32\include;socket.io-client-cpp/src;socket.io-client-cpp/lib/rapidjson/include;socket.io-client-cpp/lib/websocketpp;socket.io-client-cpp/lib/asio/asio/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<!-- This was missing -->
<AdditionalDependencies>libcrypto32MDd.lib;libssl32MDd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup> Note that I used the 32 bit library as that was your project definition but you should use the 64 bit if you are on a 64 bit plaftorm. I'm closing the issue as I consider it solved. |
Thanks a lot, Joan Marcè, for your help. In the end, all boils down to the fact that actually the remark in 'sio_client_impl.cpp' (line 22-26) is incorrect or at least is misleading. It demands that '#include <asio/ssl/impl/src.hpp>' be included in one of the source files if SSL/TSL support is needed. Maybe it makes sense to eliminate these lines from the source file to prevent such misunderstandings in the future. Thanks again for your valuable help and best regards Ludwig |
Indeed the comment is incorrect. The only needed thing is the |
I followed the basic instructions to build a CPP Client 'without cmake' (https://github.com/socketio/socket.io-client-cpp/blob/master/INSTALL.md#without-cmake) and then tried enable 'SSL/TSL' following the basic instructions found in 'sio_client_impl.cpp':
#if SIO_TLS
// If using Asio's SSL support, you will also need to add this #include.
// Source: http://think-async.com/Asio/asio-1.10.6/doc/asio/using.html
// #include <asio/ssl/impl/src.hpp>
#endif
Due to this instructions I also was asked to switch from 'ASIO_STANDALONE' to 'ASIO_SEPARATE_COMPILATION', which in turn forced me to include 'boost' and 'boost/asio' as well as 'OpenSSL' into my include path and to disable 'socket.io-client-cpp/lib/asio/asio/include' from the same.
As it turned out, apparently the 'socket.io-client-cpp' package (version 0.8.2 ?), is not compliant with the most recent boost structure changes concerning the location of 'asio/error_code.hpp' which now seems to be located at 'boost/system'.
Please advice where I can find correct instructions to enable SSL/TSL support, or otherwise, please let me know if the is any chance that this problem gets solved by the owner of this GitHub project.
Thanks and best regards
Ludwig
Used include path:
../../Vendor/boost/1.78
../../Vendor/boost/1.78/boost
../../Vendor/OpenSource/OpenSSL/1.1.1m/include
../socket.io-client-cpp/lib/rapidjson/include
../socket.io-client-cpp/lib/websocketpp
xxxx_../socket.io-client-cpp/lib/asio/asio/include
Used preprocessor settings:
WIN32
_DEBUG
_CONSOLE
_BOOST_DATE_TIME_NO_LIB
_BOOST_REGEX_NO_LIB
ASIO_SEPARATE_COMPILATION
xxxxx_ASIO_STANDALONE
WEBSOCKETPP_CPP11_STL
WEBSOCKETPP_CPP11_FUNCTIONAL
SIO_TLS
The text was updated successfully, but these errors were encountered: