-
Notifications
You must be signed in to change notification settings - Fork 182
Build socket.io library for native SDKs
OWT native SDK currently uses socket.io as the signaling protocol so it is depending on 2.0 version of socket.io-client-cpp project.
P2P SDK is not implemented directly depending on socket.io, rather, the signaling channel implementation is provided by the sample application, so P2P SDK will not link to socket.io library, nor will it use socket.io headers. But since owt-server-p2p, which is the signaling server, is using socket.io, so your P2P application will need to link to socket.io library as well.
Conference SDK is implemented with signaling channel implementation embedded in the SDK, and it is using version 2.0 of the socket.io headers. socket.io library binary will not be packed into OWT SDK binary, you will have to explicitly link to it in your application.
Your conference application must use below commands to build 2.0 version of socket.io library for Linux. cmake 2.8 and above is required for generation of build files for both Linux and Windows.
git clone --recurse-submodules https://github.com/socketio/socket.io-client-cpp.git -b 2.x-tls
cd socket.io-client-cpp
mkdir build
cd build
cmake ../
make
Build process of 2.0 version of socket.io on windows is basically the same as Linux except the final step. On Windows a .sln file will be generated. depending on the VC runtime to be used for you application, you may specify VC runtime for all projects in this solution to either /MD, /MT, /MDd or /MTd. By default the OWT Windows SDK is built with /MT for release build, and /MTd for debug builds, so the socket.io solution will need to be configured accordingly.
The socket.io library is implemented with limited TLS support. You can build socket.io library with TLS support.
When running cmake, you will need to include path to openssl binary. For example,
cmake ../ -DOPENSSL_ROOT_DIR:STRING=c:\ssl_111k_64
.
This requires ssl_111k_64 to contain a prebuilt binary of openssl library, where the build process is trying to access lib
and include
directory, as well as openssl.conf under that directory.
A sioclient_tls.vcxproj, besides the sioclient.vcxproj will be generated under sioclient.sln when OPENSSL_ROOT_DIR is specified and openssl headers can be found under specified OPENSSL_ROOT_DIR. After you build sioclient.sln, both sioclient.lib(without TLS support) and siocleint_tls.lib(with TLS support) will be created,
Special notes for openssl verison:
- You should use the latest version of 1.1.1 openssl libraries for linking to sioclient_tls.
- If you link to TLS version of sioclient library, OWT SDK must be built with owt_use_openssl=true in gn args. (passing ssl_root to build script). If you don't build OWT with openssl (instead using boringssl), you application will fail to link due to ssl symbol conflicts.
To build openssl from source by yourself:
- Install and install Nasm from https://www.nasm.us, and add nasm.exe to your PATH. Create two folders under c:, for example, ssl_111n_bin & ssl_111n_dir.
- Set VC env. Start from a command prompt and run(for example):
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" x64
- Run
perl Configure VC-WIN64A --prefix=c:\ssl_111n_bin --openssldir=c:\ssl_111n_dir no-shared
- Run 'nmake && nmake install'. Pick up libssl.lib and libcyrpto.lib under c:\ssl_111n_bin directory.
You don't need to specify OPENSSL_ROOT_DIR when running cmake, but you need to make sure 1.1.1 openssl library will be found by pkg-config --cflags --libs openssl
before running cmake.
This external post has detailed steps to build OWT with socket.io cpp.